Change UTC time in an Agent Script

Hi There

I am using the Date\Time component in an Agent Script and i have assigned this to the variable strMoveDate
When i use the calendar function to choose a date the correct date is displayed on the screen
image
However when i try to use the same variable elsewhere it is converted into UTC time
I only want the date part of the string so I created another Dynamic variable that does that using this
substr({{strMoveDate}}, 0,10)
That works fine except that the because of the time difference (AEST( +10)) this can return the wrong date if I choose today and do so before 10 am

I have managed to get around this by creating another dynamic variable and using this expression
formatDate(dateToMilliseconds({{strMoveDate}}))
This returns the current date and time of the Agents Timezone
So using this new string i can then use the other string to give me just the date
So in affect this works but it feels like there is a better way in that if i can get the proper formatting of this formula then not only would it return the proper date and timezone it could do one better and return a proper formatted date like Monday 24-04-2023

I have no idea how this formula even works formatDate(dateToMilliseconds({{strMoveDate}})) but if i remove the dateToMilliseconds part then it doesnt work, is there some way of replacing the dateToMilliseconds part that would return me a date format instead

I got this formatDate(dateToMilliseconds({{strMoveDate}})) from a Genesys website but it doesnt expand on what other options can be used

Any help would be appreciated

Regards

Andrew

Hello,

I just did few tests to try the formatDate function and the Unicode substitutions. I assume it should take into account the time difference (my timezone not far enough from GMT).

So I've created a dynamic string with: formatDate(dateToMilliseconds({{strMoveDate}}), "EEEE dd-MM-yyyy")
That should give you the format you have posted above - Monday 24-04-2023.
I am not clear what the difference is between EEEE and eeee - both appear to work.

Regards,

!!!! GENIUS !!!!, that works a treat I had tried that using dddd for day but I couldn't get it working
So Unicode was the answer for the formatDate options, thats great news

Thanks very much for replying

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.