Created
June 13, 2012 06:47
-
-
Save s-hiroshi/2922388 to your computer and use it in GitHub Desktop.
JavaScript > custom function > date
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
//日付表記を変換 | |
function changeDate(str) { | |
var myDate = new Date(str); | |
var YYYY = myDate.getFullYear(); | |
var MM = myDate.getMonth() + 1; | |
if (MM < 10) { | |
MM = "0" + MM; | |
} | |
var DD = myDate.getDate(); | |
if (DD < 10) { | |
DD = "0" + DD; | |
} | |
var date = YYYY + "/" + MM + "/" + DD; | |
return date; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment