Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Timestamps including secondsForum ↗

Timestamps including seconds

App Development3 posts471 views6 likesLast activity Sep 2020
JA
jamesljaworski85OP
Sep 2020

Hey Everyone!

I am working with the ex-bond-trading model which requires some inputs as Time. I have used type Date before and have had no problem using standard material-ui date pickers which represent dates as “2020-09-09”.

However, this particular model requires DateTime (including seconds). What format is the DAML-LF compiler expecting for this? The material ui DateTime picker returns “2020-09-09T00:00”. This didn’t work. I also tried adding seconds below.

`

> Error: JsonError: cannot interpret 2018-05-14T00:00:00 as Timestamp

`
I’m not so concerned with building a custom component that formats the DateTime correctly, as much as figuring out the correct format that DAML-LF is expecting. I can hardcode the datetime if need be for demonstration purposes.

Thanks!

CO
cocreature
Sep 2020

Hi @jamesljaworski85, you can find all documentation on the JSON format at https://docs.daml.com/json-api/lf-value-specification.html#timestamp. For DAML-LF Timestamps, you need an ISO 8601 string of a UTC time. In your example, that would be 2020-09-09T00:00Z.

JA
jamesljaworski85
Sep 2020

Thanks for pointing me in the correct direction, @cocreature! I had not seen that part of the documentation yet.

← Back to Discussions