Good afternoon,
We are working on extracting a date field from a SDM Change Order for use in an ITPAM process. I can get the date extracted through the Select Operator. However, I can only get the date extracted in Unix time and not in the MM/DD/YYYY format that I am looking for. Has anyone run into this before and how did you get around it?
Thank you,
Clinton
We are working on extracting a date field from a SDM Change Order for use in an ITPAM process. I can get the date extracted through the Select Operator. However, I can only get the date extracted in Unix time and not in the MM/DD/YYYY format that I am looking for. Has anyone run into this before and how did you get around it?
Thank you,
Clinton
Say that the date/time field from SDM is in a variable called ticketDateTime. This will convert it to the format you need:
dt = new Date(ticketDateTime * 1000)
formattedDateTime = formatDate(dt, "MM/dd/yyyy")
OR if you are not going to make use of the dt variable in any other place, you can skip creating that and combine it to just one line:
formattedDateTime = formatDate(new Date(ticketDateTime * 1000), "MM/dd/yyyy")
Note that you have to multiple by 1000 because JavaScript uses Epoch time (milliseconds since midnight on January 1, 1970) while SDM stores the number of seconds (not milliseconds) since midnight on January 1, 1970.
Thanks,
Tom