Get today's date as string

Build a custom date string from today's date
JavaScript


var mydate= new Date()
var theyear=mydate.getFullYear()
var themonth=mydate.getMonth()+1
var thetoday=mydate.getDate()

todayvalue = themonth + '/' + thetoday+ '/' + theyear ;

if (this.value=='') {this.value=todayvalue}

Posted by fbrefere001 on Monday March 6, 2006