KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have year, mont, ... , second in integer type, and I need to build NSDate from them. I tried this code, but I got (null). NSDateFormatter *tempFormatter = [[[NSDateFormatter alloc]init]autorelease]; [tempFormatter setDateFormat:@"yyyy-mm-dd hh:mm:ss"]; NSString* message = [NSString stringWithFormat:@"%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, second]; NSDate *day3 = [tempFormatter dateFromString:message]; What's wrong with this code?
Tags (comma-separated)
Save Edits
Cancel