On 18 Nov 2008, at 17:06, Greg Hoover wrote:

Ok, I buy that, but then what's the problem here:

        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        [formatter setDateFormat: @"dd/MM/YYYY"];
        NSString *str = @"3/10/2008"; 
NSLog(@"[EMAIL PROTECTED]@\r%@", str, [formatter dateFromString: str], [formatter stringFromDate: [formatter dateFromString: str]]);
        [formatter release];

This code uses the formatter both directions but prints out the following:

3/10/2008
2007-12-23 00:00:00 -0800
23/12/2007

So it's clear that there is a problem converting from the string to date. Is there an issue with creating static NSDateFormatters? Its curious because some of the date formatters in my app work as expected, others do not.

Set your date format string to "dd/MM/yyyy"

[formatter setDateFormat: @"dd/MM/yyyy"];

Simon Wolf

Cocoa Blog: http://www.ottersoftware.com/developer//developer/
Twitter: http://www.twitter.com/sgaw
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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