Java Reference
In-Depth Information
Hour of the day for 12-hour clock format: 112
l
Minute within the hour. Two digits: 0059
M
Seconds within the minute. Two digits: 0060 (60 is a leap
second)
S
Milliseconds within the second. Three digits: 000999
L
Nanoseconds within the second. Nine digits:
000000000999999999
N
Locale specific AM or PM marker.
p
Numeric offset from GMT (as per RFC 822). E.g. +1000
z
String representing the abbreviation for the time zone
Z
Seconds since the epoch.
s
Milliseconds since the epoch.
Q
So, for example, the following code will print out the current time in the
familiar hh:mm:ss format:
System.out.printf("%1$tH:%1$tM:%1$tS %n", new Date());
 
Search WWH ::




Custom Search