I have a format string on January 25, 2011 3:17. I need to convert it to NSDate. I used NSDateFormatter with the format @ "MMM d, yyyy h: mm a". It works well if the iphone time is 12 hours, but returns zero if the time is 24 hours. Can anyone help me with this ??
Capital H is used for the 24-hour format. Doesn't 24-hour time usually exclude part of AM / PM? If so, your format string should be: @"MMM d yyyy H:mm" .
@"MMM d yyyy H:mm"
Here is a link to Unicode date format strings.
This is a bug in NSDateFormatter. You can get around this by manually setting the locale in the date format:
[dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_GB"] autorelease]];
Source: https://habr.com/ru/post/1337255/More articles:Find a CUDA installation on Linux - linuxMySQL Dump for tar.gz with remote without shell access - linuxHorizontal and vertical center text in html - htmlUsing the 'ref' keyword in C # - c #Creating a dynamically updated progress bar with Rails / JQuery? - jqueryDifference between insert statement and append in SQL loader? - oracleWordpress barcode not working - wordpressInitialize ArrayList array elements - arraylistNHibernate CreateAlias - Join arbitrary columns - .netA short way to create arrays? - arraysAll Articles