What format string do I use for milliseconds in date strings on iPhone?

前端 未结 4 2218
悲&欢浪女
悲&欢浪女 2020-11-29 02:24

I\'m required to parse strings in a format that includes milliseconds. What format string do I use to get the right date value?

For example, suppose I have a string

4条回答
  •  失恋的感觉
    2020-11-29 03:14

    It's SSS, per the Unicode Locale Data Markup Language spec.

    "yyyy-MM-dd'T'HH:mm:ss.SSS"
    

    More generally, use any number of upper-case S characters to get that many decimal places in the fractions-of-a-second component. (So ss.S will show the time to the nearest tenth of a second, for example.)

提交回复
热议问题