webforms – Posting date when a submission is made

I am a newbie at Drupal, so apologies if I am missing something obvious. I searched the issues with various keywords but could not find a similar problem.

I need some data to be sent via remote post handler when webform submissions are made. One of the data needs to be sent is the date of the submission. I figured out that I need to use “webform_submission:completed” as a token. I have been trying quite a bunch of different options at “Custom Data” to send “date” properly but I got the error of converting either the value or string to DateTime. I have token module installed and can browse all available tokens.

Submission date: “‘(webform_submission:completed:custom_date)'”
(I defined custom date in config menu as m/d/Y)

{"errors":{"ArrayData(0).submissiondate":("Could not convert string to DateTime: '09/10/2020'. Path 'ArrayData(0).submissiondate', line 1, position 102.")},"title":"One or more validation errors

Submission date: “‘(webform_submission:completed:html_date)'”

{"errors":{"ArrayData(0).submissiondate":("Could not convert string to DateTime: '2020-09-10'. Path 'ArrayData(0).submissiondate', line 1, position 100.")},"title":"One or more validation errors

if I only use double quotation marks around () remote post handler does not work at all (checked recent log messages)

More info:

The following code works fine in Postman :

{"Username" : "username", "Password": "password", "StartData" : ({ "StartDate": "2018-03-29", "UniqueId" : "123123", "Id" : 123123, "IsManual" : true})}

I converted it to YAML as below and put it under “Completed Custom Data” and chose JSON as Post Type. Unchecked all submission data&saved.

Username: xxx
Password: xxx
- StartDate: "(webform_submission:completed:custom:Y-m-d)"
UniqueId: 123
Id: 123123
IsManual: true

In this case, webform.remote_post does not work at all when I create a submission- could not see debug result at the top and anything about the remote post in the recent log messages. I tried to it in Json format + replaced the token with the current date (like “2020-09-23”) to see what happens. The result is the same.

İf I use single quotation mark around “(webform_submission:completed:custom:Y-m-d)”
Response body would be as below:

{"errors":{"StartData(0).StartDate":("Could not convert string to DateTime: "2020-09-23". Path 'StartData(0).StartDate', line 1, position 121.")},"title":"One or more validation errors occurred.","status":400,"traceId":"0HM2T7KTISQLB:000015B4"}

So, I could not figure out how to format the date properly.

Thank you in advance.