How can I define a variable which would be the Date column on the database? I want it to split the value in the database so I need a variable
How can I define a variable which would be the Date column on the database? I want it to split the value in the database so I need a variable
Hi Ellen,
pre
var dateText = "23/10/2003";
var date = new Date(dateText);
var dateFormat = date.toISOString().replace(/T.*/gi, "") + "T00:00:00.000Z";
alert(dateFormat);
return dateFormat;
/pre
Regards.
So I would put that code in the JS for the label component where I want it displayed (same as before) then paste the code from earlier too?
Hi Ellen,
It's very depends on your needs what you need to do.
Regards.
I want to reorder the date and get rid of the time. I could use this code to do that but I need some sort of variable to link back to the database. It would replace value.
var yyyymmdd = value.split(" ")[0].split("-");
return yyyymmdd[1] + "-" + yyyymmdd[2] + "-" +yyyymmdd[0];
Hi Ellen,
To store in DB you should add following JS code to "Date" type request parameter:
pre
var dateText = "23/10/2003";
var date = new Date(dateText);
var dateFormat = date.toISOString().replace(/T.*/gi, "") + "T00:00:00.000Z";
alert(dateFormat);
return dateFormat;
/pre
This code will return date in correct for REST API format.
Also you can modify this code to give more dynamic logic.
Regards.
So should that be on the listing end or the creating end of things? I am not familiar with what correct REST API format is so is that yyyy-mm-dd 00:00:00 or would it be mm-dd-yyyy?
HI Ellen,
You can find more info about date format here:
http://devcenter.appery.io/documentat...
Regards.
So if I put my code at the end of it, dataFormat world replace value right?
var dateText = "23/10/2003";
var date = new Date(dateText);
var dateFormat = date.toISOString().replace(/T.*/gi, "") + "T00:00:00.000Z";
alert(dateFormat);
return dateFormat;
var yyyymmdd = value.split(" ")[0].split("-");
return yyyymmdd[1] + "-" + yyyymmdd[2] + "-" +yyyymmdd[0];
Hi Ellen,
Not sure i understand what you want to do. But i see you have two "return" statement. That means your code will run only until first one.
More details here: https://developer.mozilla.org/ru/docs...
Regards