Created
April 27, 2019 20:56
-
-
Save juanpabloprado/dd8ba6fb5459629c4205f8d183482d88 to your computer and use it in GitHub Desktop.
Period is[state] methods 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("P10D").minusDays(10); | |
p1 ==> P0D | |
jshell> "Is zero: " + p1.isZero(); | |
$24 ==> "Is zero: true" | |
jshell> // Period equals negative value | |
jshell> Period p2 = Period.parse("P2019M"); | |
p2 ==> P2019M | |
jshell> p2 = p2.minusMonths(2020); // 2019-2020 is -1 Months | |
p2 ==> P-1M | |
jshell> "Is negative: " + p2.isNegative(); | |
$27 ==> "Is negative: true" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment