cancel
Showing results for 
Search instead for 
Did you mean: 

Converting TimeZones and XML Date Formats

Former Member
0 Kudos

Hi guys

I am using xMii 12.1 SP 5

I have a requirement to build and send xml messages to PI

The Format I need to specify in my message is

<CreationDateTime>2010-09-02T03:00:56.000Z</CreationDateTime>

The format generate by defualt (using a date vairable) is

<CreationDateTime>2010-09-02T11:00:56</CreationDateTime>

So you can see I have 2 problems

#1 - How do I convert my datetime to UTC time ? (I am currently +8GMT but obviously dont want to manually adjust for daylight savings)

#2 - How do i specify the expected format.?

Any/All suggestions would be appreciated.

I want to do all of the above within a transaction if possible, but I can potentially do an XSLTransform on my created message if necessary.

Chris

Accepted Solutions (0)

Answers (1)

Answers (1)

jamie_cawley
Advisor
Advisor
0 Kudos

You would need to create either a custom action or post to a jsp page to get the time difference. 12.2, currently in ramp up, does includes funtions for handling timezones. For jsp something like the following should work with the http post action...

<%@ page import = "java.util.*"%>
<%
Calendar calendar = new GregorianCalendar();
calendar.setTimeZone(TimeZone.getDefault());
int dtz = calendar.get(Calendar.HOUR_OF_DAY); 
calendar.setTimeZone(TimeZone.getTimeZone("GMT"));
out.println(calendar.get(Calendar.HOUR_OF_DAY) - dtz);
%>

Jamie