Created
April 12, 2016 22:41
-
-
Save dtanner/d294f817c539a47e7f3bc51fbb893d82 to your computer and use it in GitHub Desktop.
Example showing some java.time date manipulation
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
import java.time.LocalDate | |
import java.time.temporal.TemporalAdjusters | |
LocalDate localDate = LocalDate.now() | |
println localDate // 2016-04-12 | |
println localDate.plusMonths(1).withDayOfMonth(1) // 2016-05-01 | |
println localDate.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()) // 2016-03-31 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment