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

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -