[New Plugin] UNIX Converter

You are right and no need to include. You did more than expected. ( I got as far as the offset but stuck at the date still converting to local system time whenever it saw a date)

It is just that I’ll have to figure out the conditions tomorrow (had some urgent calls come in between) as I do not see the two sides match the dates yet.

I tried saving a UNIX timestamp (1519931581) as a date in Bubble and it returned Jan 18, 1970… seems like it tried, is Bubble able to recognize UNIX timestamps as dates? That’d be nice. @emmanuel

Did you find a solution?
And if so, has the Bubble Version update changed things at all?

*EDIT - I found a solution for my specific scenario, but maybe others are interested in this specific topic

What specific issue are you referring to?

Was specifically asking about this part

Still trying to figure out this, need to save a date & time in a SearchBox location’s timezone, and have it always show up as that time (can’t just use text for sorting/filtering reasons) regardless of where the Current User is

You can save it as Unix UTC time zone. Then convert that too the search box timezone.

I am struggling to save it as UTC time zone. I understand the calculations to get it if I know a User’s offset from UTC, but not sure how to figure out a Current User’s Offset from UTC?

As the User may not always be in the same time zone (not always a static Offset like in Jarrads example)

The example’s live version shows the static value, but if you check out the create button in the editor there is a dynamic input for offset.

What expression could I use for the ‘users offset’ field to calculate the value, instead of putting a set number there?

My Users won’t always be in the same time zone, so I need to calculate the offset depending on their current time zone

if your familiar with the toolbox plugin I can give you a function to grab the users current offset in the current timezone?

function getOffset(){
var offset = new Date().getTimezoneOffset() / 60; 
return offset
};

bubble_fn_1(getOffset()); // returns the offset as type number to bubble. eg. -9.5
1 Like

That works perfect, thanks!

1 Like

My users are not in the same timezone. I was struggling with offset first but the Unix plugin will just save it as UTC independent of user location.

I’ll make a screenshot when I’m back at the pc.

So for what it’s worth:

When the date picker is changed, this runs:

Then the date input has a default value of:

image

I tried a lot of things with regards to saving offsets etc, but it was all messy. For some reason the default unix extract action in Bubble doesn’t give the correct UTC Unix, but this plugin does.

1 Like

@jarrad could you have a quick look please at the UNIX plugin? It seems the conversion happens really slow or not at all at the moment. Thanks!

edit: seems like the API is having performance issues: http://www.convert-unix-time.com

This plugin isn’t working anymore, I get this error whenever I try to make a call. Is there any other way to convert a UNIX timestamp to a Bubble date type? This conversion is crucial for our app to function properly, as many of our APIs return dates as a UNIX timestamp and we need to control and manipulate those dates in Bubble.

UNIX%20Converter%20Error%202

This is being sorted asap, apologies - judging from the message on the site they may have a few issues of there own…

In the meantime, this plugin does exactly what I need, converting UNIX to a Bubble datetype. Thanks for your work @jarrad

Hey guys. Our page is only a fun side-project and the API was not intended to be used in real …
bubble and we are already working on it and hopefully come up with a solution for it soon. Meanwhile i try to improve the performance of the api temporary with more hardware resources.

It works again! :slight_smile:

Any news on this @jarrad? Is this perhaps turning into a zeroqode plugin? You mentioned you were working on a new script, hoping that will still be finished…

Unix Converter seems to be down. Anyone else getting that issue? Seems like the site they run the conversion through is offline.