Skip to content

Instantly share code, notes, and snippets.

@kanemu
Created September 3, 2011 12:11
Show Gist options
  • Select an option

  • Save kanemu/1191089 to your computer and use it in GitHub Desktop.

Select an option

Save kanemu/1191089 to your computer and use it in GitHub Desktop.
[javascript]タイムスタンプ
var timeStamp = function(){
var d,i,ary;
d = new Date();
ary = [
d.getFullYear(),(d.getMonth()+1),d.getDate(),
d.getHours(),d.getMinutes(),d.getSeconds()
];
for(i=0,len=ary.length;i<len;i++){
ary[i] = (ary[i]<10)? '0'+ary[i]:''+ary[i];
};
return ary.join('-');
};
alert(timeStamp());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment