Method toUniversalString
Method toUniversalString (lines 28–31) takes no arguments and returns a String in universal-time format, consisting of two digits each for the hour, minute and second—recall that you can use the 0 flag in a printf format specification (e.g., "%02d") to display leading zeros for a value that doesn’t use all the character positions in the specified field width. For example, if the time were 1:30:07 PM, the method would return 13:30:07. Line 30 uses static method format of class String to return a String containing the formatted hour, minute and second values, each with two digits and possibly a leading 0 (specified with the 0 flag). Method format is similar to method System.out.printf except that format returns a formatted ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access