Re: NSDate and millis
Re: NSDate and millis
- Subject: Re: NSDate and millis
- From: Jens Alfke <email@hidden>
- Date: Fri, 4 Apr 2008 09:41:28 -0700
On 4 Apr '08, at 8:41 AM, Torsten Curdt wrote:
NSDate *date1 = [[NSDate alloc] initWithString:@"2008-05-01
00:00:00 +0200"];
NSLog(@"date1=%@, %lf", date1, [date1 timeIntervalSince1970]);
Whatever default date formatter is being used doesn't support parsing
milliseconds. You're lucky it even matches the same syntax you're
using (there are zillions of incompatible date formats.)
Moral of the story: Never rely on a default date formatter. Never call
-[NSDate initWithString:]. Create your own NSDateFormatter instance
and set its format string exactly the way you want it.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden