Format string for NSDateFormatter to produce milliseconds

后端 未结 2 1820
傲寒
傲寒 2021-01-17 11:08

Since my date is well formatted now all there is left for me to do is to print milliseconds too.

I already tried setDateFormat yyyy/mm/dd hh:mm:ss:ms

相关标签:
2条回答
  • 2021-01-17 11:45

    Try this format:

    "yyyy/MM/dd HH:mm:ss.SSS"
    
    0 讨论(0)
  • 2021-01-17 11:57

    Try to use 'SS' specifier (with number of S's equal to number of digits you want to get - 3 in your case), e.g.

    [formatter setDateFormat:@"yyyy/MM/dd hh:mm:ss:SSS"];
    
    0 讨论(0)
提交回复
热议问题