Page 1 of 1

How to add data of date type to database

Posted: Wed Oct 22, 2014 3:12 pm
by Claes Dahlberg

I wan't to add a current date when posting new item to appery database.
I've done a mapping of the fields and for the date field I've tried the following java script instead of mapping line:

var d=new Date();
return d.toISOString().replace("T"," ").replace("Z","");

This doesn't work and I don't know how! Please help!
/Claes


How to add data of date type to database

Posted: Wed Oct 22, 2014 5:20 pm
by Kateryna Grynko

Hi Claes,

Please try without editing the string: prevar date = new Date();
return date.toISOString();/pre


How to add data of date type to database

Posted: Sun Oct 26, 2014 5:30 pm
by Yang Mega

The above have a timezone problem!!! Do we have better solution ?


How to add data of date type to database

Posted: Sun Oct 26, 2014 6:36 pm
by Alena Prykhodko

Could you please clarify what exactly are you trying to do?


How to add data of date type to database

Posted: Mon Jan 26, 2015 8:30 am
by M&M

If you want a string representation of a "UTC" or unix timestamp, this is what you need

var UTCstring = (new Date()).toUTCString();


How to add data of date type to database

Posted: Mon Jan 26, 2015 8:31 am
by M&M

If you want a string representation of a "UTC" or unix timestamp, this is what you need

var UTCstring = (new Date()).toUTCString();