NSDateFormatter string format for displaying milliseconds

I need to get the current date in this format:

yyyy-MM-dd-hh-mm-ss-XXX

But what letters should you use for milliseconds?

+3


source to share


2 answers


As described by Unicode , S

means fractional second:

Fractional second round - number of letters. (example for 12.34567)



Use as much as possible S

for a given accuracy.

+5


source


The letters for miliseconds are SS, so you should do:



yyyy-MM-dd-hh-mm-ss-sss

+4


source







All Articles