Re: NSTimestampFormatter adjusts TZ for display, SimpleDateFormat doesn't?
Re: NSTimestampFormatter adjusts TZ for display, SimpleDateFormat doesn't?
- Subject: Re: NSTimestampFormatter adjusts TZ for display, SimpleDateFormat doesn't?
- From: Paul Hoadley <email@hidden>
- Date: Wed, 15 Apr 2009 21:10:28 +0930
Hi Andrew,On 15/04/2009, at 7:40 PM, Andrew Lindesay wrote: I have my own home-rolled formatters for date/time, but I am (as you obviously are) interested in using SDF instead. I figured that if SDF did not do this "timezone fiddle" itself, I would subclass it to achieve the correct value and then invoke super to handle the format. Likewise, I would do this in reverse for parse. I essentially undertake this transformation in my formatters. Keep us posted on your experiments.
It turns out that (not too surprisingly) SimpleDateFormat _will_ adjust timezones on format, but I was using an NSTimeZone, and ignoring this warning:
WARNING: NSTimeZone is only intended to be used with NSTimestamp and NSTimestampFormatter. It produces incorrect results when used with Java's date-related classes.
If I feed SimpleDateFormat the analogous java.util.TimeZone object, it adjusts the time as expected. Nothing to see here.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden