Add Unix Timestamp and Javascript Timestamp converstions to the date/time app

The idea is:

The Date and Time app has 7 actions. I suggest adding two to easily convert Unix and Javascript timestamps.

My use case:

I’m exporting Zillow API data and all the listing date/times and change date/times are in Unix Time Stamp (aka milliseconds) Example: listingDateTimeOnZillow: 1699724220000.

I think it would be beneficial to add this because:

Having this to convert to mm/dd/yyyy or any other format needed would help us not have to implement a code block with javascript to process such a remedial task.

Any resources to support this?

Are you willing to work on this?

Do I even possess this capability? LOL

Hey @Ibanez1998,

You can already do this in the Date & Time node, I have put an example below for you. You may also be able to do this in an expression using Luxon.

Let me know if either of these approaches work for you.

That’s great news! A bit obscure though if I think about it. Perhaps it can still be added as an actual action to make it more visible of a solution?

Hey @Jon , thanks for all the help quick question for you. Is there a way to pass multiple date fields (perhaps like search for all of them) and have the modification done?

Use set node to modify time in the value field

check my mini help to find modification to your needs
if $json.body.listingDateTimeOnZillow is unix miliseconds
{{DateTime.fromSeconds($json.body.listingDateTimeOnZillow/1000).toFormat(‘yyyy-MM-dd HH:mm:ss’)}}
// Output: 2023-10-13 17:23:58

{{DateTime.fromSeconds(new Date().getTime()/1000).toFormat(‘yyyy-MM-dd HH:mm:ss’)}}
// Output: 2023-10-13 17:23:58

{{Math.floor(new Date().getTime() / 1000)}}
// Output: 1573041058

{{new Date().getTime()}}
// Output: 1573041058024

{{new Date().toISOString()}}
// Output: 2019-11-06T11:50:58.025Z

{{new Date().toString()}}
// Output: Wed Nov 06 2019 12:50:58 GMT+0100 (Central European Standard Time)

{{new Date().toLocaleDateString()}}
// Output: 11/6/2019

{{ new Date().toISOString(“en-GB”, {timeZone: "Europe/Moscow"}).replace(‘T’, ’ ').slice(0, -5) }}
// Output ISO: 2022-12-04 21:26:27

2023-02-21T22:43:59+03:00 to unix - {{Date.parse( $json.body.date) / 1000}}
if 2023-04-03T08:20:33Z - {{ DateTime.fromISO($json.create_time).toFormat(‘yyyy-MM-dd HH.mm’) }}

plusmonths:
{{DateTime.fromISO($json[“body”][“date”]).plus({ months: $json[“months”] }).toUnixInteger()}}

{{Math.floor(new Date().getTime() / 1000)+30}} - unix+30 secomds

another example - Google Calendar How do I set up a notification in advance? - #3 by nle

@Jon thoughts on adding it to Date/Time to make it clearer?

Hey @Ibanez1998,

It is kind of already there and is easy enought to do, It can also be done with Luxon in expressions but while I personally don’t think we need this if the community vote for this then it would be something to add.