PureConnect

 View Only

Discussion Thread View
  • 1.  GMT/UTC to PST conversion in a handler

    Posted 05-18-2018 19:28
    HI, 

    I'm trying to convert date and time from PDT/PST to UTC/GMT in a handler. 

    What's the best way to do it? 

    I want handler to automatically figure out that PST = UTC-7 and UTC-8 base Daylight Savings. 

    I don't see a way to do it without hardcoding number of seconds and i'd really wanna stay away from that as it does not solve for Daylight Savings. 


    Dmitry.

    ------------------------------
    Dmitry Dyment
    Beachbody, LLC
    ------------------------------


  • 2.  RE: GMT/UTC to PST conversion in a handler

    Posted 05-21-2018 08:48
    Unfortunately, I am not aware of a way to do it directly in a handler.  The datetime functions all assume that you are passing it a UTC value already.  One way that I have done this in the past is to use SQL view like this:

    SELECT GETUTCDATE() AS UTCDateTime, GETDATE() AS LocalDateTime, DATEDIFF(s, GETUTCDATE(), GETDATE()) AS DiffSeconds

    You wouldn't necessarily have to run this query every time.  If you wanted something more efficient, simply run it at 3AM every day to update a server parameter that holds that UTC Offset value.  Then use the server parameter value in the handler.  Not pretty but it works.

    ------------------------------
    Steve Owen
    Avtex
    ------------------------------



  • 3.  RE: GMT/UTC to PST conversion in a handler
    Best Answer

    Posted 05-21-2018 10:23
    ​Dmitry

    I just created a new handler for this also. What I did is set a new assignment with this value DateStrTZ($Now, "Pacific Standard Time") which will convert the utc to PST for you automatically.

    ------------------------------
    Sheldon Breading-Goodrich
    Financial Engines, Inc.
    ------------------------------



  • 4.  RE: GMT/UTC to PST conversion in a handler

    GENESYS
    Posted 05-21-2018 10:28
    Dmitry,

    What is the source of the PST/PDT date? Is it a database, current datetime, CRM...something else?

    ------------------------------
    George Ganahl
    Principal Program Manager
    Genesys
    ------------------------------



  • 5.  RE: GMT/UTC to PST conversion in a handler

    Posted 05-22-2018 10:02
    You can use the date time TZ functions to specify the time zone you want to create the date and then use the get functions to pull back the converted UTC date/time. The system is "smart" and actually creates the date time at UTC but embeds an offset based off of the time zones available by the OS the CIC server is running on.

    ------------------------------
    Mark Tatera
    ConvergeOne

    Opinions are my own and not the views of my employer. Any suggestions or programming changes I suggest come with no warranty and should be tried at your own risk.
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources