I try to change my Here is the code: This is what I Experiment: EDIT: If you can not change the string, then you can use this code to do this: NSString to
NSDate object , But
NSDateFormatter gives me a weird price.
NSDateFormatter * dateFormat = [[NSDateFormatter alloc] init]; [DateFormat setDateFormat: @ "yyyy-MM-dd HH: mm"]; NSDate * date = [dateFormat dateFromString: @ "2012-08-15 00:00"]; [DateFormat release];
date is value
2012-08-14 21:00 +0000 . This is the difference of 3 hours between the
NSString value and the
NSDate value. I think I have forgotten something, but I do not know what is
NSDateFormatter * dateFormat = [[NSDateFormatter alloc] init]; [DateFormat setDateFormat: @ "yyyy-MM-dd HH: mm: SSZZZ"]; NSDT * date = [dateformat detfrostring: @ "2012-08-15 00:00:00 +0000"]; NSLog (@ "\ n \ n DATE:% @ \ n \ n \ n", date);
+0000 is the timezone, so make sure that you use your timezone, such as
+0400 .
NSDateFormatter * dateFormat = [[NSDateFormatter alloc] Init]; [DateFormat setDateFormat: @ "yyyy-MM-dd HH: mm"]; [DateFormat SettimeJohn: [nystimjon timezonefoursecondframmmt: 0]]; NSDate * date = [dateFormat dateFromString: @ "2012-08-15 00:00"];
Comments
Post a Comment