Created
April 27, 2019 21:17
-
-
Save juanpabloprado/8d35aeb59d9b2a32cf1c1e22002d1d1c to your computer and use it in GitHub Desktop.
Period normalized method on the Java Shell tool
This file contains 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
jshell> Period p1 = Period.parse("P0Y13M"); | |
p1 ==> P13M | |
jshell> "Original: " + p1 + " Normalized: " + p1.normalized(); | |
$36 ==> "Original: P13M Normalized: P1Y1M" | |
jshell> Period p2 = Period.parse("P2Y-1M"); | |
p2 ==> P2Y-1M | |
jshell> "Original: " + p2 + " Normalized: " + p2.normalized(); | |
$38 ==> "Original: P2Y-1M Normalized: P1Y11M" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment