How to record Web form entry date and time




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(;

    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"


Accepted Solutions (1)

Accepted Solutions (1)

Answers (1)

Answers (1)



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