Skip to content

Instantly share code, notes, and snippets.

@cocodrips
Created July 24, 2015 03:03
Show Gist options
  • Save cocodrips/47c3b0f37c93efa37def to your computer and use it in GitHub Desktop.
Save cocodrips/47c3b0f37c93efa37def to your computer and use it in GitHub Desktop.
jsで日付好きな文字でjoinするのが見つからなかった
var date_string = function(d, join) {
//Date -> 20150101
var year = (d.getYear() + 1900).toString();
var month = ('0' + (d.getMonth() + 1).toString()).slice(-2);
var day = ('0' + d.getDate().toString()).slice(-2);
return year + join + month + join + day;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment