Skip to content

Instantly share code, notes, and snippets.

@timpulver
Created May 16, 2012 10:15
Show Gist options
  • Save timpulver/2709266 to your computer and use it in GitHub Desktop.
Save timpulver/2709266 to your computer and use it in GitHub Desktop.
Returns the current date as Int in this form YYYYMMDD
/*
* 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