Javascript to format date like mm/dd/yyyy hh:mm:ss

[code lang=”js”]

var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1;//January is 0!
var yyyy = today.getFullYear();
var hours = today.getHours();
var minutes = today.getMinutes();
var seconds = today.getSeconds();
d=mm+’/’+dd+’/’+yyyy+’ ‘+hours+’:’+minutes+’:’+seconds


This entry was posted in Code and tagged , , , .

Post a Comment

You must be logged in to post a comment.