PDA

View Full Version : Date and time format




portem1
Jan 21, 2011, 06:24 AM
It is on objective c soma Date and time format? Then i'm using:

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *date1 = [dateFormatter dateFromString:@"2011-02-16 12:00:00"];

date1 becomes = 2011-02-16 10:00:00 GMT. So i can not use NSDate for date and time?



robbieduncan
Jan 21, 2011, 07:06 AM
How have you ascertained that the date has become 2011-02-16 10:00:00 GMT? What timezone are you in? As you did not specify the timezone when you created the date from the string the date will have been converted from your phones set timezone. If the timezone of the phone is currently GMT+2 then the two dates are actually the same.

Vancelot
Jan 21, 2011, 07:33 AM
Try auto date and time.