1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Date and time format

Discussion in 'iPhone/iPad Programming' started by portem1, Jan 21, 2011.

  1. portem1, Jan 21, 2011
    Last edited by a moderator: Jan 21, 2011

    macrumors newbie

    #1
    It is on objective c soma Date and time format? Then i'm using:

    Code:
    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?
     
  2. Moderator

    robbieduncan

    Staff Member

    #2
    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.
     
  3. macrumors newbie

    #3
    Try auto date and time.
     

Share This Page