ios - How to calculate NStimeZone differeces -
hi trying sync time server time. in india(ist) getting time zone , converting gmt format , calculating timestamp , finding delta value server time , using timestamp .. thats working fine.. me..
now changing time zone , calculating timeinterval in between existing tiemzone , new timezone , appending delta value not getting getting time interval 19800
nsdate* sourcedate1 = [nsdate date]; nstimezone* sourcetimezone1 = [nstimezone timezonewithabbreviation:@"asia/clacutta"]; nstimezone* destinationtimezone1 = [nstimezone localtimezone]; nsinteger sourcegmtoffset1 = [sourcetimezone1 secondsfromgmtfordate:sourcedate1]; nsinteger destinationgmtoffset1= [destinationtimezone1 secondsfromgmtfordate:sourcedate1]; nstimeinterval interval1 = destinationgmtoffset1 - sourcegmtoffset1; nsdate* destinationdate = [[nsdate alloc] initwithtimeinterval:interval1 sincedate:sourcedate1];
long delt=interval1+delta;
i not getting current result .. trying right way? or other thing need change
Comments
Post a Comment