Genesys Cloud - Main

 View Only

Sign Up

Expand all | Collapse all

Set timezone UTC+7 in call flow and show on script

  Thread closed by the administrator, not accepting new replies.
  • 1.  Set timezone UTC+7 in call flow and show on script

    Posted 01-07-2024 10:29
    No replies, thread closed.

    How to set timezone UTC+7 in call flow and show on script

    from format : MM/DD/YY HH:MM:SS  to format : DD/MM/YY HH:MM:SS (UTC+7)


    #ArchitectureandDesign
    #Implementation
    #Routing(ACD/IVR)

    ------------------------------
    Nuttapong Limadisai
    G-Able Public Company Limited
    ------------------------------


  • 2.  RE: Set timezone UTC+7 in call flow and show on script

    Posted 01-08-2024 07:05
    No replies, thread closed.

    Can you show the expression of adding 7 hours to the StartDateTimeUtc?



    ------------------------------
    Mostafa Awad
    ------------------------------



  • 3.  RE: Set timezone UTC+7 in call flow and show on script

    Posted 01-09-2024 09:57
    No replies, thread closed.

    adding 7 hours is the time taken from the script. I didn't change anything.



    ------------------------------
    Nuttapong Limadisai
    G-Able Public Company Limited
    ------------------------------



  • 4.  RE: Set timezone UTC+7 in call flow and show on script

    Posted 01-08-2024 09:02
    No replies, thread closed.

    It would be very good to have a method toLocaleString with a function in Architect available, but today I see only a build value manually with your example.

    The problem is situation then the change time zone changes the date of the date time variable.

    Att,



    ------------------------------
    Breno Canyggia Ferreira Marreco
    https://www.linkedin.com/in/brenocfm-40b62182/
    ------------------------------



  • 5.  RE: Set timezone UTC+7 in call flow and show on script

    Posted 01-09-2024 03:54
    No replies, thread closed.

    To get local time with Daylight Savings time changes you can use a Data Action to get /api/v2/timezones?pageSize=500

    This contains the offset for each timezone.

    You can then add the offset duration to the UTC time variable in Architect.



    ------------------------------
    Jan Heinonen
    Contact Center Specialist
    GlobalConnect AB
    ------------------------------



  • 6.  RE: Set timezone UTC+7 in call flow and show on script

    Posted 01-09-2024 09:59
    No replies, thread closed.

    @Jan Heinonen Is there an easier way to do this in Architect?



    ------------------------------
    Nuttapong Limadisai
    G-Able Public Company Limited
    ------------------------------



  • 7.  RE: Set timezone UTC+7 in call flow and show on script

    Posted 01-09-2024 03:56
    Edited by Jan Heinonen 01-09-2024 03:57
    No replies, thread closed.

    To get local time with Daylight Savings time changes you can use a Data Action to get /api/v2/timezones?pageSize=500

    This contains the offset for each timezone.

    You can then add the offset duration to the UTC time variable in Architect.

    EDIT: Sorry for duplicate, it got stuck when posting and didn't show at first on reload

    ------------------------------
    Jan Heinonen
    Contact Center Specialist
    GlobalConnect AB
    ------------------------------



  • 8.  RE: Set timezone UTC+7 in call flow and show on script

    Posted 01-09-2024 08:28
    No replies, thread closed.

    I guess to interesting your use with /api/v2/timezones?pageSize=500.

    Could You demonstrate a simple use? I don't see how I use for datetime converter.

    if I used pure javascript I created this code:

    const timezone = {

    id: "America/Sao_Paulo",

    offset: -180,

    };

    const utcDateTime = "2024-07-01T19:34:09Z";

    const date = new Date(utcDateTime);

    date.setHours(date.getHours() - timezone.offset);

    Is Architecht running it? date.setHours(date.getHours() - timezone.offset), if right, excellent!!

    Att,



    ------------------------------
    Breno Canyggia Ferreira Marreco
    https://www.linkedin.com/in/brenocfm-40b62182/
    ------------------------------



  • 9.  RE: Set timezone UTC+7 in call flow and show on script

    Posted 01-09-2024 13:49
    No replies, thread closed.

    Handling date formats in Agent scripts is a pain, but there is a function in the agent script for it. (which takes a millisecond integer as input so need to use Unix Epoch timestamp, just cast your datetime in architect to integer to get this value)

    https://help.mypurecloud.com/articles/additional-functions-to-use-in-dynamic-variables

    And there is this idea:

    https://genesyscloud.ideas.aha.io/ideas/OP-I-113

    I suspect no matter what you do in Architect, the Agent script will try to be 'helpful' and interpret it as a date and apply the current format to it. Not sure about this but you might be able to trick it by putt a prefix in front like an empty space or something like that so it is just a string and not converted to date.



    ------------------------------
    Anton Vroon
    ------------------------------



  • 10.  RE: Set timezone UTC+7 in call flow and show on script

    Posted 01-10-2024 03:39
    No replies, thread closed.

    Hi, 

    Just happened I implemented a call flow recently for UTC+8, share with you here my architect's call flow that verifies the date.

    In the Update Data object, I have created 4 variables

    1. Task.ConvertedDate (Type: DateTime) - to convert the date into YYYYMMDD that I want because the caller input from another system which only has ddmmyy
    2. Task.UTC8 (Type: DateTime) - get UTC+8
    3. Task.UTC8_OnlyDate (Type: DateTime) - Convert UTC +8 to the format YYYYMMDD, without the time
    4. Task.duration (Type: Duration) - get the day difference in between the inputted date and UTC +8

    Here are the expressions of ConvertedDate:

    •  MakeDateTime(2000 + ToInt(Right(Flow.newddmmyy,2)), ToInt(Substring(Flow.newddmmyy,2,2)), ToInt(Substring(Flow.newddmmyy,0,2)), 0, 0, 0)

    Expressions of UTC8 :

    • AddHours(GetCurrentDateTimeUtc(),8)

    Expressions of UTC8_OnlyDate :

    • MakeDateTime(Year(Task.UTC8), Month(Task.UTC8), Day(Task.UTC8), 0, 0, 0)

    Expressions of duration :

    • DateTimeDiff(Task.ConvertedDate,Task.UTC8_OnlyDate)

    Hope this is helpful for you.

    Regards



    ------------------------------
    Johnson Lu
    MFE International Pte Ltd.
    ------------------------------



  • 11.  RE: Set timezone UTC+7 in call flow and show on script

    Posted 01-10-2024 10:47
    Edited by Nuttapong Limadisai 01-10-2024 11:36
    No replies, thread closed.

    @Johnson Lu

    Where did you create flow.ddmmyy? Can you show it to me?

    and you can show type statement in UTC8_OnlyDate?
    ------------------------------
    Nuttapong Limadisai
    G-Able Public Company Limited
    ------------------------------



  • 12.  RE: Set timezone UTC+7 in call flow and show on script
    Best Answer

    Posted 01-10-2024 13:40
    No replies, thread closed.

    If all you want is to add 7 hours to the datetime to have utc+7, you can just adjust the expression you already have.

    So something like

    Append(ToString(Day(Flow.StartDateTimeUtc)),"/",ToString(Month(Flow.StartDateTimeUtc)),"/",ToString(Year(Flow.StartDateTimeUtc))," ", ToString(Hour(Flow.StartDateTimeUtc) + 7),":",ToString(Minute(Flow.StartDateTimeUtc)),":",ToString(Second(Flow.StartDateTimeUtc)))

    Just be mindful that Scripter might recognize this as a datetime and try to reformat it, in which case you would need to do the in scripter date time formatting.



    ------------------------------
    Anton Vroon
    ------------------------------



  • 13.  RE: Set timezone UTC+7 in call flow and show on script

    Posted 01-11-2024 02:26
    No replies, thread closed.

    @Anton Vroon Thank you so much. It works so well, why am I overlooking this small point?




    ------------------------------
    Nuttapong Limadisai
    G-Able Public Company Limited
    ------------------------------



  • 14.  RE: Set timezone UTC+7 in call flow and show on script

    Posted 01-11-2024 00:37
    No replies, thread closed.

    Hi,

    I collected ddmmyy from the customer.

    Regards



    ------------------------------
    Johnson Lu
    MFE International Pte Ltd.
    ------------------------------



  • 15.  RE: Set timezone UTC+7 in call flow and show on script

    Posted 01-11-2024 02:27
    No replies, thread closed.

    @Johnson Lu thank you for information



    ------------------------------
    Nuttapong Limadisai
    G-Able Public Company Limited
    ------------------------------