Created
January 29, 2016 14:59
-
-
Save slezicz/67a4f5f8658b8333d6d8 to your computer and use it in GitHub Desktop.
Add DAY to date
This file contains hidden or 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
String dt = "2008-01-01"; // Start date | |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
Calendar c = Calendar.getInstance(); | |
c.setTime(sdf.parse(dt)); | |
c.add(Calendar.DATE, 1); // number of days to add | |
dt = sdf.format(c.getTime()); // dt is now the new date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment