objective c - NSDateformatter Converting date to string -


i having following date , time 2013-04-25 10:42:44 +0000. when convert above date string, getting output 2013-04-25 16:12:44. following code using convert date string

    nsdateformatter *dateformatter = [[nsdateformatter alloc]init];     dateformatter.timezone = [nstimezone systemtimezone];     [dateformatter setdateformat:@"yyyy-mm-dd hh:mm:ss"];     nsstring *datestr= [dateformatter    stringfromdate:date]];     nslog(@"datestr--%@",datestr); 

this gets asked on , on (but difficult find via search).

when log nsdate object, date in utc format. how description method of nsdate implemented.

as long difference seeing can accounted based on local timezone relative utc, seeing correct , expected behavior.

btw - there no reason set date formatter's timezone "system" timezone. done default. same locale. set timezone or locale if want different current values.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -