开发者

Problem with NSDateformatter

开发者 https://www.devze.com 2022-12-24 13:56 出处:网络
i\'ve seen many questions on NSDateformatter and NSDate, but none could help me out. [formatter setDateFormat:@\"yyyy/mm/dd\"];

i've seen many questions on NSDateformatter and NSDate, but none could help me out.

[formatter setDateFormat:@"yyyy/mm/dd"];
        NSDate *date = [formatter dateFromString:@"2010/03/10"];
        if (date) {
            NSLog(@"Date returned:::%@",date);
            return date;
        }

The Probelm is that, its returning the date --- '2010-01-10 00:03:00 +0600' The month is changed to 1 and the minute to 3, What might be the p开发者_如何学Pythonroblem???


Use MM for month, instead of mm. See the Unicode Standard for reference.


use

[formatter setDateFormat:@"yyyy/MM/dd"];

It is considering small mm to minutes that's why i guess...

0

精彩评论

暂无评论...
验证码 换一张
取 消