Discussion

Converting the datetime to user time zone

Hello,

 

When I query @(Pega-RULES:DateTime).CurrentDateTime() im getting the Datetime in GMT as expected, but I'd like to get the local time of the user who is accessing the PRPC server from a remote location. There is a Timezone option in the operator ID that we can use and format the date time, but the timezone is in the America/NewYork format, but we need the three letter code (EST, PST) to format the timezone.

 

Thanks,

Pradeep

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

August 11, 2014 - 12:31pm

Hi,

Try this... Use @CurrentDateTime() to fetch the time in GMT.

Pass that to @CurrentDate(@CurrentDateTime(), "<time zone>") , will return you the value with time zone in 3 letters.

Check the functionality of @CurrentDAte() in expression builder.

 

August 18, 2014 - 10:41am

Thank you, but my question is how do we configure the time zone for a given user, Lets say I have three users one in EST, one in MST and one in CST. We need to configure the users with these time zones, but as of now Pega does not use this three letter code in Operator ID forms, it uses America/New York for EST becuase EST does not cover EDT (the day light timezone), where as America/New York covers both EST and EDT.

Pega
August 20, 2014 - 12:54am

Pradeep,

You should not need to specify the timezone of the client, pega will pick up the time zone of the requestor automatically. To test this I added the following logic to a DataTransform:

.ServerDT = @CurrentDateTime()

//ServerDT = 20140820T042212.720 GMT

.ClientDT = @FormatDateTime(.ServerDT, "\tdatetime_default",null,null)

//ClientDT = Aug 19, 2014 11:22:12 PM  When I have my client set to Chicago time, note the server date and time (ServerDT) is Aug 20, 04:22 GMT

Replace "\tdatetime_default"   with  "EEE, d MMM yyyy HH:mm z" and you get:    

Tue, 19 Aug 2014 23:22 CDT

For a list of formats see here and for details on coding your on format see here, also for information to help test timezone and localization issues in Pega see here.

Hope this clears up any issues you were having.

Regards,

Cecil Howell, CSA |  Senior Instructor  

November 13, 2015 - 7:17am

Hi Howec,

we have a requirement for display datetime property into GMT /IST/EST/PST dynamically based on user timezone, do we have any OOTB function etc, by which we can achieve.