Hi,
I am building a Web form to collect some data from users and I want to record the creation time of each form entry.
I created a field with type "datetimenotz" in the schema and I have issues storing the datetime value into it.
May I know what is the expected input type and format of the SQL data type "datetimenotz"?
JS script to run after form submission and before Storage:
function getUTCDate() {
var date = new Date(Date.now());
return pad("00", date.getUTCDate()) +
'/' + pad("00", (date.getUTCMonth() + 1)) +
'/' + date.getUTCFullYear() +
' ' + pad("00", date.getUTCHours()) +
':' + pad("00", date.getUTCMinutes()) +
':' + pad("00", date.getUTCSeconds());
}
function pad(pad, str) {
if (typeof str === 'undefined') {
return pad;
} else {
return (pad + str).slice(-pad.length);
}
}
ctx.my_schema.@datetime = getUTCDate();
Error message:
TIM-030009 Date '05/04/2018 05:55:17': invalid character at position 5 ('4') Invalid type for value '05/04/2018 05:55:17' from element '@datetime' (document of type 'somenamespace:my_schema'). XSV-350023 Unable to save document of type 'somenamespace:my_schema'. SOP-330011 Error while executing the method 'Write' of service 'xtk:persist|xtk:session'.
Source schema:
<attribute advanced="false" label="datetime" name="datetime" sqlname="datetime"
type="datetimenotz"/>
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Have you checked this page? Depending on the type of database you use, there might be some slight differences for the types of data to use.
https://docs.campaign.adobe.com/doc/AC/en/CFG_Schema_Reference_Schema_structure.html
Florent
Views
Replies
Total Likes
Hi,
Have you checked this page? Depending on the type of database you use, there might be some slight differences for the types of data to use.
https://docs.campaign.adobe.com/doc/AC/en/CFG_Schema_Reference_Schema_structure.html
Florent
Views
Replies
Total Likes
I ran into a similar issue.
When I changed my code this it worked.
var date = formatDate(getCurrentDate(),"%4Y/%2M/%2D %02H:%02N:%02S")
This is the link to the documentation from the JSAPI
Views
Replies
Total Likes