I am stuck in a very strange situation. I have a database in SQLite having column "DATETIME". In this column there is a value say "2011-10-05 12:00:46". I am converting this by using NSDateFormatter, I set the NSDateFormatter like this -
[df setDateFormat:@"yyyy-MM-dd HH:MM:ss"];
[df dateFromString:completedDate];
when i run my project in iPhone simulater this works fine and i got the result as i want. When i debug same project in device and check the value of object type NSDate i got null value.
Please tell me what wrong i am doing.
Thanks
Your date format is wrong. Capital M
is meant for Month. For Minute you should use small m
. Your date format should look like this.
@"yyyy-MM-dd HH:mm:ss"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.