I have multiple values returns by HubSpot node that are in unix format :
I would need to convert all those dates on regular format date like MM/DD/YYYY I’ve been able to do it manually for one date using the Date/Time module but what if I have 20 different dates ?
Thanks for the reply !
So I wanted to first try with only one value using the Date/Time module.
The first thing is that the module will only return the data IF it contains a date :
sort via if node
true if time exist. if exist then two one go to next,second format time and put merge 1 from formatted time, 2 from original workflow.
false if time not exist. if not exist - go to next
use merge node for append
{{DateTime.fromMillis(1616344794000).toFormat('dd/MM/yyyy')}}
not
{{DateTime.fromMillis(1616344794000).toFormat(‘dd/MM/yyyy’)}}
error in 'dd/MM/yyyy'
Thinking just like this
or you can use your original workflow. Set node append new data by default.
try to
{{DateTime.fromMillis($node.HubSpot.json.properties.hs_date_entered_customer.value).toFormat('dd/MM/yyyy')}}
or
{{DateTime.fromMillis($json.properties.hs_date_entered_customer.value).toFormat('dd/MM/yyyy')}}
or
{{DateTime.fromMillis(Number($json.properties.hs_date_entered_customer.value)).toFormat('dd/MM/yyyy')}}
or
{{DateTime.fromMillis(Number($json["properties"]["hs_date_entered_customer"]["value"])).toFormat('dd/MM/yyyy')}}
Last two worked !
So it was indeed because it returned a string and not “numer” it seems.
That’s weird because I also tried with parseInt and it didn’t work, but now it does either with parseInt or Number.
Just a heads up - I’ve attached this thread to an internal feature concept that would convey expected datatype of a parameter. Agree that this could be clearer in n8n.