Skip to content

Instantly share code, notes, and snippets.

@dtanner
Created April 12, 2016 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtanner/d294f817c539a47e7f3bc51fbb893d82 to your computer and use it in GitHub Desktop.
Save dtanner/d294f817c539a47e7f3bc51fbb893d82 to your computer and use it in GitHub Desktop.
Example showing some java.time date manipulation
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