Last active
December 2, 2018 08:51
-
-
Save onacit/9f67e77d19cd60ee43a8dc936d3a9bd7 to your computer and use it in GitHub Desktop.
Prints information from java.time.temporal.ChronoUnit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.temporal.*; | |
public class ChronoUnitMatrix { | |
public static void main(final String... args) { | |
System.out.printf("%-10s%-6s%-6s%s\n", "name", "time", "date", | |
"duration (estimated) (seconds)"); | |
System.out.printf("%-10s%-6s%-6s%s\n", "---------", "-----", "-----", | |
"---------------------------------------------------------------"); | |
for (final ChronoUnit value : ChronoUnit.values()) { | |
System.out.printf("%-10s%-6b%-6b%s (%b) (%d)\n", value.name(), | |
value.isTimeBased(), value.isDateBased(), | |
value.getDuration(), value.isDurationEstimated(), | |
value.getDuration().get(ChronoUnit.SECONDS)); | |
} | |
} | |
} |
Author
onacit
commented
Dec 2, 2018
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment