Problem with current date format?

I have a simple button in a form that I want to set the value of a DATETIME field to the current date and time.
I use a one line method:

forms.sessions.startsession=Date();

but get the following error:

Setting dataprovider with name ‘startsession’ / type ‘DATETIME’ with value of wrong type Wed Oct 25 2006 20:29:38 GMT+1000 (EST)
java.lang.IllegalArgumentException: Setting dataprovider with name ‘startsession’ / type ‘DATETIME’ with value of wrong type Wed Oct 25 2006 20:29:38 GMT+1000 (EST)

why doesnt this simple line work? How do I need to reformat to get the DATETIME filed to accept the current date & time?

I had missed out one word:

forms.sessions.startsession=new Date();

Your code should work. The error you are getting looks like you are passing the toString() value of a date to that field. For example, if you write something like

column = new Date() + ''

you are converting the new Date() to a String and get that sort of error.

What is your database? Can you post the whole code?

Hi Al,
It works here.
try

forms.sessions.startsession= application.getTimeStamp()

FWIW

date_of_note = application.getTimeStamp()
application.output(date_of_note)
date_of_note = Date()
application.output(date_of_note)
date_of_note = new Date()
application.output(date_of_note)

produces this output

Thu Oct 26 06:36:12 EST 2006
Thu Oct 26 2006 06:36:12 GMT+1000 (EST)
Thu Oct 26 06:36:12 EST 2006

They all work, just the outputted date format is different for Date() vs new Date()