Page 1 of 1

ISO Date Format Conversion

Posted: Wed Jul 29, 2009 11:53 pm
by subramanya
Hi,

Is there any function to convert the current DateTimestamp into the following ISO date format: 2009-07-29T11:20:32.0Z

Thanks

Posted: Thu Jul 30, 2009 12:17 am
by ray.wurlod
Which ISO standard specifies that format? What is "0Z"?

ISO 8601 (date and time formats) specifies YYYY-MM-DD HH:MM:SS with optional fractional seconds for a timestamp).

Conversion is only relevant if the target is a string data type.

Posted: Thu Jul 30, 2009 12:31 am
by chulett
Apparently that's a Java implementation of an "ISO 8601" format and I keep seeing search results calling it a SimpleDateFormat. For example, go here and scroll down to Method Detail and the isoFormat entry. The 'Z' seems to be a timezone offset.

Posted: Thu Jul 30, 2009 12:32 am
by subramanya
Thanks for the reply
ray.wurlod wrote:Which ISO standard specifies that format?
Not sure. My guess is that this is an extended format for ISO 8601.
ray.wurlod wrote:What is "0Z"?
'Z' is the zone designator for the zero UTC (Coordinated Universal Time) offset.

Posted: Thu Jul 30, 2009 4:36 pm
by ray.wurlod
OK, you're probably going to need a fairly complex expression to effect the conversion from local time to UTC if the solution needs to be general, or use a constant offset for a limited result. (Incidentally, how is Indian Standard Time (4.5 hours offset) represented?)

The rest should just be decomposing the string, adjusting the hour (and, possibly, the day), then re-assembling the string. Should be able to do it all in stage variables.

Posted: Wed Sep 15, 2010 11:47 am
by anu123
subramanya

Did you find a solution? We have a requirement to convert UTC datatime into EST and load into a DB2 table.

It would great if you can share the solution.

Thanks in advance.