Skip to content

Instantly share code, notes, and snippets.

@kuyseng
Created May 26, 2012 04:01
Show Gist options
  • Save kuyseng/2792119 to your computer and use it in GitHub Desktop.
Save kuyseng/2792119 to your computer and use it in GitHub Desktop.
javascript: indesign get date string
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