Re: Cocoa-dev Digest, Vol 7, Issue 35
Re: Cocoa-dev Digest, Vol 7, Issue 35
- Subject: Re: Cocoa-dev Digest, Vol 7, Issue 35
- From: Marcus Grenängen <email@hidden>
- Date: Fri, 8 Jan 2010 20:36:59 +0100
Just create a NSDateFormatter specifying the format of the expected date/time:
NSDateFormatter *dateExtracter = [[NSDateFormatter alloc] init];
[dateExtracter setDateFormat: @"yyyy-MM-dd'T'HH:mm:ss"];
[dateExtracter setTimeZone: [NSTimeZone timeZoneWithName:@"UTC"]]; // All date/times is received in UTC (if needed) 'Z' marks that the time is in UTC...
Then you just call:
NSDate *date = [dateExtracter dateFromString: @"2010-01-08T08:09:20Z"];
>
> Hi,
>
> I am having a time stamp string like 2010-01-08T08:09:20Z
>
> I would like to know how I could convert this to a represented NSDate
> object.. Is it possible to do this without separating the string into
> several parts..
>
> Thank you and Kind Regards,
>
> tharindufit.wordpress.com
>
>
Regards.
Marcus Grenängen, Software Engineer
SourceTech AB
Phone: +46 (0)8 447 63 03
Cellphone: +46 (0)702 474 297
Email: email@hidden
Web: http://www.sourcetech.se
Blog: http://grenangen.se
_______________________________________________
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