Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Format of DateTime

849532Mar 22 2011 — edited Mar 24 2011
Hey,

I'm curious at formatting a date time a certain way. I'm working with XMLBeans and have a node with datatype DateTime. According to the article:

http://www.w3schools.com/schema/schema_dtypes_date.asp

The section under "DateTime Data Type" specifies that:

Time Zones
To specify a time zone, you can either enter a dateTime in UTC time by adding a "Z" behind the time - like this:

<startdate>2002-05-30T09:30:10Z</startdate>

or you can specify an offset from the UTC time by adding a positive or negative time behind the time - like this:

<startdate>2002-05-30T09:30:10-06:00</startdate>

or

<startdate>2002-05-30T09:30:10+06:00</startdate>


I'm working on a PC which is currently has the Windows Time Zone: (UTC) Dublin, Edinburgh, Libson, London

How would I set the value of a node to be of the format as UTC offset (2002-05-30T09:30:10-06:00). I assume that since my PC is already on GMT, the date would be formatted as the 1st startDate (2002-05-30T09:30:10Z) ?

Also, if my PC was at (UTC -5:00) Eastern Time, how would I get that to be formatted like the bold date time?

Is there a single date formatter to handle either of these cases? Never really used the Java classes for date time manipulation.

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 21 2011
Added on Mar 22 2011
10 comments
496 views