n8n doesn’t use momentjs library, Which is where that syntax is from. N8n uses the luxon Library.
if you’re using ChatGPT specify the luxon library and it should give you the right answer.
How you convert it to a time will depend on what the format is in. If it is in iso format you can do {{ DateTime.fromISO("2016-05-25T09:24:15") }}
if not, you can look through the other parsing methods or use the fromFormat("","") syntax. That would be like {{ DateTime.fromFormat("2016-05-25T09:24:00", "yyyy-MM-dd'T'HH:mm:ss") }}
Then from there you can use .format("") to get any format you like.
Like {{ DateTime.fromFormat("2016-05-25T09:24:00", "yyyy-MM-dd'T'HH:mm:ss").format(“yyyyMMdd”) }}
Hope that helps. If you have trouble parsing the date in the format you have please share it and I’ll help you out
That time shown is actually in ISO format so it’s easy, just use .fromIso("").
If you waned to do it manually. that would be yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
And from what I understand the expression always has to be a single line and I cannot use things to make it easier to read such as intermediate variables.
Is there any way to make this more manageable because I can’t imagine having this in multiple nodes and trying to keep them updated?
$json tends to mean the data is coming from the input so this means the node before has a date field in the output which is where it is coming from as to why it is different I am not sure it could be that one is a sent date and one is the local recieved date.