1
我想下面的字符串轉換爲一個NSDate對象:NSDate的假設錯誤的時區
NSString *[email protected]"25 May 2012 10:25:00";
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"d MMM yyyy HH:mm:ss"];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"asia/kolkata"]];
NSDate *date = [dateFormatter dateFromString:str];
In console : date-->2012-05-25 04:55:00 +0000....it lags behind 5 hours and 30 minutes and assumes GMT timezone instead of Asia...Why it is so?
是......真的......! – addy 2012-02-25 07:49:08