[Java] java formatting time to milliseconds

Java code  

java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");

The various date representation letters in JAVA are as follows:

G Era symbol Text AD
y year Year 199696
M Month of the year Month JulyJul07
w Week of the year Number 27
W Week number of month Number 2
D Number of days in the year Number 189
d Days in month Number 10
F Day of the month Number 2
E Days of the week Text TuesdayTue
a Am/pm mark Text PM
H The number of hours in a day (0-23) Number 0
k Number of hours in a day (1-24) Number 24
K Hours in am/pm (0-11) Number 0
h Hours in am/pm (1-12) Number 12
m Minutes in hour Number 30
s Seconds in minutes Number 55
S Milliseconds Number 978
z Time zone General time zone Pacific Standard TimePSTGMT-08:00
Z Time zone RFC 822 time zone -0800

 Reference article

https://www.cnblogs.com/jpfss/p/9480818.html

Guess you like

Origin blog.csdn.net/xiaoxiao_su123/article/details/114256379