Click to See Complete Forum and Search --> : Need to change the date format


alexdel
04-13-2006, 01:14 AM
Cant get the Date() method to change format. Always displays the default setting. How do i get it to change the format to this dd/mm/yyyy

heres my function code:
function timeDate() {
document.form.date.value = Date();
}

any advice would be great

Thank You

Alex

balloonbuffoon
04-13-2006, 02:54 AM
Date() has sub functions to get the day, year, month, etc. Here's an example:
function timeDate() {
nD = new Date();
document.form.date.value = nD.getDate() + "/" + (nD.getMonth()+1) + "/" + nD.getFullYear();
}

--Steve

Kor
04-13-2006, 03:05 AM
see:
http://www.w3schools.com/jsref/jsref_obj_date.asp

alexdel
04-13-2006, 04:27 AM
thanks alot guys for the replys,

Alex