Java Date Increment -
this question has answer here:
- how can increment date 1 day in java? 22 answers
i'm trying figure out how increment dates in java.
the date i'm trying increment is, 2012-10-01.
the following represents increments:
- 2012-10-01 - 2013-09-30
- 2013-10-01 - 2014-09-30
- 2014-10-01 - 2015-09-30
- 2015-10-01 - 2016-09-30
with new java time api can use localdate:
localdate date = localdate.parse("2012-10-01"); (int = 0; < 4; i++) { system.out.println(date + " - " + date.plusyears(1).minusdays(1)); date = date.plusyears(1); }
Comments
Post a Comment