JavaScript Error

They have: 38 posts

Joined: Dec 2002

I got a script:

<script language="JavaScript">
1) ? nd.getYear().substr(2,2) : nd.getYear();
var mins = nd.getMinutes();
var hours = (nd.getHours() > 12) ? nd.getHours() - 12 : nd.getHours();
var pmam = (nd.getHours() > 12) ? "pm" : "am";
var newdate = month + "/" + day + "/" + year + " " + hours + ":" + mins + pmam;
document.Registration.Date.value = newdate;
}
//-->
</script>

it does not seem to want to print the correct date. It prints out November instead of December

What is wrong with it?

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

Is your system date ok?

They have: 38 posts

Joined: Dec 2002

yes it is! Smiling

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You do know that JavaScript starts with 0, right? So 11 IS December.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.