nsdate - stringFromDate returning the wrong year -


#define stddateformat @"yyyymmdd't'hh:mm:ssz" nsdateformatter *dateformat = [[nsdateformatter alloc]init]; [dateformat setdateformat:stddateformat]; nsstring *timeofsync = [dateformat stringfromdate:syncdate]; nslog(@"date format: %@",stddateformat); nslog(@"syncdate: %@",syncdate); nslog(@"timeofsync: %@",timeofsync); 

logged output:

date format: yyyymmdd't'hh:mm:ssz syncdate: 2009-01-03 19:00:00 +0000 timeofsync: 20080103t11:00:00-0800 

can help? thing can see space before timezone in input date string. thanks.

use lowercase yyyy year instead of yyyy.

uppercase y means year of start of week date in (jan 3, 2009 in week starts in 2008).

see unicode date format patterns.


Comments

Popular posts from this blog

jQuery clickable div with working mailto link inside -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -