SimpleDateFormat cannot parse milliseconds with more than 4 digits

前端 未结 7 696
花落未央
花落未央 2020-12-06 13:20

I want to parse a timestamp, like this - \"2016-03-16 01:14:21.6739\". But when I use the SimpleDateFormat to parse it, I find that it outputs an i

相关标签:
7条回答
  • 2020-12-06 13:55

    SS in SimpleDateFormat is milliseconds. You have 6739 milliseconds, which means you are adding an extra 6.7 seconds onto your time. Perhaps you can truncate the 6739 to 673 (or if you prefer, round it to 674) so it can be parsed correctly as milliseconds.

    0 讨论(0)
提交回复
热议问题