Convert date format, BMC Remedy/smart-it

1.3k views Asked by At

Problem: In a field called $Detailed Decription$ sometimes dateformat 08/09/2021 is enterd and this need to be converted to swedish format 2022-02-11

I'am going to use BMC Developer studio and make a filter but i cant find a fitting solution for it. Replacing it wont work (i think) becaus it need to have a value to replace it with.

Maby there can be a function that reads regex (\d{2})/(\d{1,2})/(\d{4}) but how can i convert it?

2

There are 2 answers

0
Mark On

If it's sometimes - look at AR System User Preferencje form. Check certain user's locale and date time config. Also is important where the data comes from. Could be a browser setting or java script mod.

1
Emrah Ozbekar On

1- Using Set fields action, copy the date value from Detailed Description to a Date/Time field (i.e. z1D_DateTime01).

2- Using Set fields action and Functions (MONTH, YEAR, DAY, HOUR, MINUTE, SECOND) you can parse the date/time and convert it to format you like.

Something like this:

SwedishDate = YEAR($z1D_DateTime01$) + "-" + MONTH($z1D_DateTime01$) + "-" + DAY($z1D_DateTime01$)

This will capture the parts of date and combine them with "-" in the middle and in the order you want.