Created
May 16, 2012 10:15
-
-
Save timpulver/2709266 to your computer and use it in GitHub Desktop.
Returns the current date as Int in this form YYYYMMDD
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
/* | |
* Returns the current date as Int in this form YYYYMMDD | |
*/ | |
int getCurDate(){ | |
String month = String.valueOf(month()); | |
if(month.length() == 1) month = "0" + month(); | |
String day = String.valueOf(day()); | |
if(day.length() == 1) day = "0" + day(); | |
return Integer.parseInt(year() + "" + month + "" + day); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment