• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTimestampFormatter adjusts TZ for display, SimpleDateFormat doesn't?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


-- 
Paul.

w  http://logicsquad.net/
h  http://paul.hoadley.name/


 _______________________________________________
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

References: 
 >NSTimestampFormatter adjusts TZ for display, SimpleDateFormat doesn't? (From: Paul Hoadley <email@hidden>)
 >Re: NSTimestampFormatter adjusts TZ for display, SimpleDateFormat doesn't? (From: Andrew Lindesay <email@hidden>)

  • Prev by Date: Re: NSTimestampFormatter adjusts TZ for display, SimpleDateFormat doesn't?
  • Next by Date: Re: Frontbase Database access on Deploy
  • Previous by thread: Re: NSTimestampFormatter adjusts TZ for display, SimpleDateFormat doesn't?
  • Next by thread: JavaClient offline storage / replication
  • Index(es):
    • Date
    • Thread