Created
September 3, 2011 12:11
-
-
Save kanemu/1191089 to your computer and use it in GitHub Desktop.
[javascript]タイムスタンプ
This file contains hidden or 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
| 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