cancel
Showing results for 
Search instead for 
Did you mean: 

Timezone offset in XSL

ManoelCosta
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

I'm already formatting a Date to different formats depending on language, using this:

<xsl:value-of select="java:com.sap.xmii.Illuminator.ext.ExtFunctions.dateFromXMLFormat(., java:com.sap.xmii.Illuminator.localization.WebLocalizer.getLocalizedString('PROJECT', $Language, 'DATE_FORMAT'))"/>

What should I use to do timezone offset conversions? I mean, what java:com.sap.xmii... should I use to add or remove hours depending of a offset>

Thank you.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Something like this might work:

<xsl:value-of select="java:com.sap.xmii.Illuminator.ext.ExtFunctions.dateFromSecondsFormatted((java:com.sap.xmii.Illuminator.ext.ExtFunctions.dateToSeconds(.)+<your time zone seconds offset, like 7200L for 2 hours >), java:com.sap.xmii.Illuminator.localization.WebLocalizer.getLocalizedString('PROJECT', $Language, 'DATE_FORMAT'))"/>

ManoelCosta
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thank you Christian, I will try it right now and come back to you!

ManoelCosta
Product and Topic Expert
Product and Topic Expert
0 Kudos

Christian,

I couldn't put this to work! It keep saying: Unable To Create Stylesheet Transformation

I also tried just to do the dateToSeconds step and it is not working either. I tried:

<xsl:value-of select="java:com.sap.xmii.Illuminator.ext.ExtFunctions.dateToSeconds(.)"/>

And got the same " Unable To Create Stylesheet Transformation " message.

Any other idea?


Thank you!

Former Member
0 Kudos

The dateFromOffset method might work for you:

<xsl:value-of select="java:com.sap.xmii.Illuminator.ext.ExtFunctions.dateFromXMLFormat(java:com.sap.xmii.Illuminator.ext.ExtFunctions.dateFromOffset(. , '1900-01-01T00:00:00', '1900-01-01T02:00:00'), 'yyyy-MM-dd HH:mm:ss')"/>

It adds the difference of date2 and date3 to date1.