Lithu T.V
Lithu T.V

Reputation: 20021

NSString to NSDate conversion with GMT value

How to set the date formatter setformat option for a date string like this to get NSDate object??

31-07-2012 11:00:00 GMT 05:30

I just need the formatter string to work out on this function OR is there something more to do to get date from this string??

-(void)setDateFormat:(NSString *)string;

Note: I know and worked on the NSDateformatter but cant sort this one out....!!!

Upvotes: 0

Views: 866

Answers (2)

akshay1188
akshay1188

Reputation: 1667

if the format is

31-07-2012 11:00:00 GMT+05:30

you can use

[dateFormatter setDateFormat:@"dd-MM-yyyy HH:mm:ssZZZZ"]

Upvotes: 1

Linden Liu
Linden Liu

Reputation: 254

I found this blog describes the NSDate and NSString very clear. http://oleb.net/blog/2011/11/working-with-date-and-time-in-cocoa-part-1/. You can refer it.

Upvotes: 1

Related Questions