Javascript date object

October 27th, 2008 § 0

var mytime = new Date()
var mymonth = mytime.getMonth() + 1 // for javascript january = 0  correct this by adding 1
var myday = mytime.getDate()
var myyear = mytime.getFullYear()
document.write(mymonth + "/" + myday + "/" + myyear)
Beware that this is the date on the client's computer. For forms use the date on your server.

Related Blogs

  • Related Blogs on

Related posts:

  1. Prototype: submit multiple select with ajax call

Tagged: ,

§ Leave a Reply

What's this?

You are currently reading Javascript date object at westworld: a webmasters best friend.

meta