Add javascript date variable to execution gives error

Hi All,

I am trying to add javascript date type from a script task and I am getting following serializable exception when going to start the process/

var myDate = new Date();
execution.setVariable(“myDate”, myDate);

Error : Cannot serialize object in variable ‘myDate’: SPIN/DOM-XML-01030 Cannot create context"

Any idea on this? Do we have to use it as a string ?

Thanks in advance