please suggest how convert local time est time. have googled did not relevant answer foe same.
any appreciated.
nsstring *str = @"2012-12-17 04:36:25"; nsdateformatter* gmtdf = [[[nsdateformatter alloc] init] autorelease]; [gmtdf settimezone:[nstimezone timezonewithname:@"gmt"]]; [gmtdf setdateformat:@"yyyy-mm-dd hh:mm:ss"]; nsdate* gmtdate = [gmtdf datefromstring:str]; nslog(@"%@",gmtdate); nsdateformatter* estdf = [[[nsdateformatter alloc] init] autorelease]; [estdf settimezone:[nstimezone timezonewithname:@"est"]]; [estdf setdateformat:@"yyyy-mm-dd hh:mm:ss"]; nsdate *estdate = [estdf datefromstring:[gmtdf stringfromdate:gmtdate]]; // can use str nslog(@"%@",estdate);
Comments
Post a Comment