It's my understanding from ISO8601 that when you include a trailing 'Z' in a
string form of a date/time that that indicates the timezone as UTC.
However when giving a string of this form to Joda, it instead converts it to
local timezone unless you force it to UTC:
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
public class JodaDateTimeZone {
// example date from ISO spec:
// http://dotat.at/tmp/ISO_8601-2004_E.pdf
private static final String UTC_DATE = "1985-04-12T10:15:30Z";
public static void main(String[] args) {
DateTime dateTime = new DateTime(UTC_DATE);
System.out.println(dateTime.toString());
dateTime = new DateTime(UTC_DATE, DateTimeZone.UTC);
System.out.println(dateTime.toString());
}
}
Can someone explain the rationale behind this unexpected behavior?
Thanks,
Ed
Disclaimer link. To see it, click the link below, or copy and paste it into
your browser's address line.
http://www.citco.com/emaildisclaimer.htm
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest