On 27 Apr 2009, at 02:41, Jon wrote:

it appears there is a bug in Apple's date formatter:

                        NSDateFormatter *inputFormatter = [[NSDateFormatter 
alloc] init];
                        [inputFormatter setDateFormat:@"MMM-dd-yy HH:mm:ss 
zzz"];
NSDate *theDate = [inputFormatter dateFromString:@"Apr-04-09 10:30:03 PDT"];

this gives the wrong timezone in "theDate"??? (unless of course you happen to be in the PDT timezone) it looks like it ignores the format, and just puts in current time zone.

I'm not sure that things are quite as simple as you think :-)

The problem with the three-letter time zone codes is that many of them are ambiguous. For instance, you might think EST meant UTC-5, whereas an Australian would expect EST to be UTC+10. As a result, you probably need to specify a bit more information rather than just "PDT"; I'm not 100% certain, but the following *might* work:

NSDate *theDate = [inputFormatter dateFromString:@"Apr-04-09 10:30:03 PST8PDT"];

also using the natural language formater properly gives me the correct time Zone, but as soon as you store it in a Data Source, it comes back out with the current time zone, and the time adjusted so that it is correct time at least... but this shouldn't happen? should it.

You can't store something in a data source, at least not for the usual Cocoa meaning of data source. Data sources are a type of delegate object, usually one that you implement yourself (unless you're using bindings, in which case the system does it for you).

Where are you storing the date? And in what form? Are you using bindings or Core Data, or did you implement your own data source object?

Kind regards,

Alastair.

--
http://alastairs-place.net



_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to