Skip to content

Instantly share code, notes, and snippets.

@ksysctl
Last active December 20, 2015 07:19
Show Gist options
  • Select an option

  • Save ksysctl/6092304 to your computer and use it in GitHub Desktop.

Select an option

Save ksysctl/6092304 to your computer and use it in GitHub Desktop.
Get today string zero padded
today = new Date();
today = '' +
('000' + today.getFullYear()).slice(-4) +'-'+
('0' + today.getMonth()).slice(-2) +'-'+
('0' + today.getDay()).slice(-2);
/* today is:
####-##-## (YYYY-MMM-DD)
sample:
2013-03-09
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment