Legacy Dev Forum Posts

 View Only

Sign Up

Change UTC time in an Agent Script

  • 1.  Change UTC time in an Agent Script

    Posted 06-05-2025 19:23

    Andrew_Russell1 | 2023-04-14 04:00:28 UTC | #1

    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 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 https://help.mypurecloud.com/articles/additional-functions-to-use-in-dynamic-variables/

    Any help would be appreciated

    Regards

    Andrew


    Jerome.Saint-Marc | 2023-04-14 09:46:24 UTC | #2

    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,


    Andrew_Russell1 | 2023-04-17 01:18:07 UTC | #3

    !!!! 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


    system | 2023-05-18 01:18:18 UTC | #4

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


    This post was migrated from the old Developer Forum.

    ref: 19445