Date and time format

Discussion in 'iOS Programming' started by portem1, Jan 21, 2011.

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

    portem1 macrumors newbie

    Jan 18, 2011
    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?
  2. robbieduncan Moderator emeritus


    Jul 24, 2002
    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. Vancelot macrumors newbie

    Dec 25, 2010

Share This Page