JSON Date Conversion


#1

My query returns dates in the following format /Date(1425859200000+0000)/
Timestamp in milliseconds from 1970 I believe.
I need to convert to 01/02/2015… Is there a formatter built into Wappler to handle this or a combination of format conversions?

I’ve tried:
{{myDate.substring(6, 19).toNumber().toDate()}}
{{myDate.substring(6, 19).toNumber().toDateString()}}

Thanks Mim


#2

try {{myDate.substring(6, 16).toNumber().toDate()}}, you need a unix timestamp which is the number of seconds from 1970, so 3 numbers less.


#3

Much appreciated @patrick