I need to send the current date in this format yyyymmdd via a hidden form input field.

I have the date formatted as I want with this javascript

```
function getDate()
{
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10){dd='0'+dd} if(mm<10){mm='0'+mm} today = yyyy+mm+dd;
}

```

And this is my form input field

```
<input type="hidden" name="startdate" onload="this.value = getDate();"/>

```

I've tried several ways to assign the date above to my var startdate and send it to the server, without any success.

Can you show me how to pass the date to my hidden input field when the page loads?

And I'm wondering if this posses any problems with regards to security and hackers?

Thanks for your help