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?
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?