Created
May 26, 2012 04:01
-
-
Save kuyseng/2792119 to your computer and use it in GitHub Desktop.
javascript: indesign get date string
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 get_date_string(para_date) { | |
var date = para_date || new Date(); | |
var day = (date.getDate() > 10 ) ? date.getDate() : ("0" + date.getDate() ), | |
month = ((date.getMonth()+1) > 10 ) ? (date.getMonth()+1) : ("0" + (date.getMonth()+1) ), | |
year = (date.getFullYear() > 10 ) ? date.getFullYear() : ("0" + date.getFullYear() ), | |
hours = (date.getHours() > 10 ) ? date.getHours() : ("0" + date.getHours() ), | |
minutes = (date.getMinutes() > 10 ) ? date.getMinutes() : ("0" + date.getMinutes() ); | |
return year + month + day + "_" + hours + minutes; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment