0

I create timestamp format like this:

ddMMMMyyyyHHmm

It works well when I use 24 hours format. It result like this 09January20191009

But when I change to 12 hours format in general datetime settings. It show AM or PM behind it.

What timestamp correct format to get same timestamp result even user change from 24 hours format to 12 hours format?

Sarimin
  • 707
  • 1
  • 7
  • 18
  • Have you looked at this: https://developer.apple.com/documentation/foundation/dateformatter. There it says: "For most fixed formats, you should also set the locale property to a POSIX locale ("en_US_POSIX"), and set the timeZone property to UTC." It shows you an example. – Jacob Jan 09 '19 at 04:26
  • I am using this now as timestamp, it works both on 24 and 12 hours format : https://stackoverflow.com/questions/39829831/how-to-get-18-digit-current-timestamp-in-swift – Sarimin Jan 09 '19 at 05:10

0 Answers0