Question
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689982000/7a6f5fc4-9cd8-4bb1-8c8b-b0f68422876e.jpg?itok=wZKgWoTE)
Hoverstate
SV
Last activity: 22 Jun 2018 14:52 EDT
Setting a Dynamic Timezone (Pega Timezone)
Good afternoon!
So, as the title says, my question is related to setting up dynamically a Timezone inside a HTML rule in PEGA (Or setting up the timezone that PEGA sets when displaying a property, like pxCreateDateTime for example).
The scenario I have is this, I'm doing an HTML rule to export the results of a report to Excel, and inside that there's a piece of JSP code I was using to get the Default TimeZone, which I thought was gonna be the same of PEGA:
final TimeZone tz = TimeZone.getDefault();
String timeZone=tz.getID();
And below this, is how I format the output for the excel (Which, without formatting, just comes out in GMT Timezone, which is the same as the property itself):
DateTimeUtils dtu = ThreadContainer.get().getDateTimeUtils()
String pxCreateDateTime= tools.getStepPage().getString("pxCreateDateTime");
pxCreateDateTime = dtu.formatDateTime(pxCreateDateTime, "MM/dd/yy hh:mma", timeZone, "");
tools.appendString("<td wrap> " + timeZone + " " +pxCreateDateTime + "</td>");
So the thing is that, I see PEGA by default changes the GMT timezone from the property to another timezone (Let's say, server timezone). Is there a way to replicate that behavior? I tried the above approach but it just picks a Default Timezone (Probably specified somewhere, but it's a different timezone than the one in the PEGA report).
If any more clarification is needed, feel free to ask!
Thanks in advance,
- Luis Fernando Orellana
Good afternoon!
So, as the title says, my question is related to setting up dynamically a Timezone inside a HTML rule in PEGA (Or setting up the timezone that PEGA sets when displaying a property, like pxCreateDateTime for example).
The scenario I have is this, I'm doing an HTML rule to export the results of a report to Excel, and inside that there's a piece of JSP code I was using to get the Default TimeZone, which I thought was gonna be the same of PEGA:
final TimeZone tz = TimeZone.getDefault();
String timeZone=tz.getID();
And below this, is how I format the output for the excel (Which, without formatting, just comes out in GMT Timezone, which is the same as the property itself):
DateTimeUtils dtu = ThreadContainer.get().getDateTimeUtils()
String pxCreateDateTime= tools.getStepPage().getString("pxCreateDateTime");
pxCreateDateTime = dtu.formatDateTime(pxCreateDateTime, "MM/dd/yy hh:mma", timeZone, "");
tools.appendString("<td wrap> " + timeZone + " " +pxCreateDateTime + "</td>");
So the thing is that, I see PEGA by default changes the GMT timezone from the property to another timezone (Let's say, server timezone). Is there a way to replicate that behavior? I tried the above approach but it just picks a Default Timezone (Probably specified somewhere, but it's a different timezone than the one in the PEGA report).
If any more clarification is needed, feel free to ask!
Thanks in advance,
- Luis Fernando Orellana
***Edited by Moderator Marissa to update platform capability tags***