Can someone write a quick plug in that convert Unix time

Seem like there is a big issue with converting unix time available at many places to something that Bubble can convert into a data (appartenyl becuase bubble wants unix time in milliseconds and its not usually available that way.

There are two plugins that call a slow server to do the conversion. But there is a way to do it locally but its REALLY cumbersome. Cant someone write a plug in that installs this conversion, locally, as an action?

The sequence would be

an expression of:
Current date/time
zero out seconds
add seconds: PMT (rate 0 nper 1000 pv Current date/time, zero out seconds, extract milliseconds )
add seconds: date_in_seconds_to_convert

I know @jarrad started writing something but I haven’t seen him in a while so not sure where that ended exactly.

The problem with this is, zeroing out seconds aligns current date/time with the current user’s timezone, which may be okay if the current user is on UTC timezone offset.

Another approach is using Toolbox Expression for client, or Server script for API Workflow… set the return type as date and do:

new Date(date_in_seconds_to_convert * 1000)

FYI this is possible for server side, but for client side there is a limitation on the plugin builder, actions don’t return values, so you’d need to add an element to the page, and have the element return a value.

Which would be fine. Math.js does that…adds an invisible element.

But I’m amazed this doesnt exist. I’ve found another local way to do it similar to above. you have to do current time change year to 1970, month to 1, date to 1, and 0 for hours minutes and seconds, then add the UNIX time which is in seconds. This works… but it takes a long time to implement
.
There really needs to be a better plug in

Oh wait, you are the one that wrote the above stuff and the time converter I was using!

Haha yes, “Seconds to date” was my first ever plugin, I wouldn’t use it now, I’d use one of the alternatives above.

Moment,js is great for this type of stuff. I just slapped together an open source plugin to do both relative time and unix time conversion. If anyone wants to contribute to the plugin or merge their own work, feel free. I don’t have much time for maintenance these days.

Here’s the link:

You could also copy/paste the code from that plugin into an html element (e.g. inside of script tags), and use @mishav toolbox for storage and data manipulation if you want to avoid having too many plugins installed in your app.