If I’m not interested in the time can I ignore it? I.e I have a date string that looks like this @"2012-12-19T14:00:00" but I’m only interested in getting the date (2012-12-19) but if I set NSDateFormatter like [dateFormatter setDateFormat:@"yyyy-MM-dd"]; it will return me a nil NSDate.
If I’m not interested in the time can I ignore it? I.e I have
Share
An NSDate object will always contain a time component as well, as it is representing a point in time — from this perspective one could argue the name NSDate is misleading.
You should create a date formatter for creating dates from string, set the time to the start of the day and use a second date formatter to output the date without time component.
results in
while the format — as it is chosen by styling — will be dependent of your environment locale