Forum Academy Marketplace Showcase Pricing Features

Timestamp convertion to Date(UNIX)

Often enough API’s return timestamps to represent certain date and times. I found a very cool trick using Bubble’s built-in Date (UNIX) that allows you to automatically convert the timestamp to a date.

Bubble recognizes them as a number so you’ll need to modify the response manually.

The result:

Screenshot - 2021-04-03T092832.220


Unfortunately, @nocodeventure, I’ve found this type doesn’t actually render correctly (unless I’m doing something wrong) when the date (UNIX) typed field is then displayed in an RG. For example, this is a configuration I’ve made for a Get API call:

But THIS is what I get when I display the “created_at” field’s value in a Text element. :frowning: The right-hand value is the actual value extracted to UNIX, which converts just fine.


Any tips on getting the value to ACTUALLY display correctly? I’m sure I’m just missing something…

Try multiplying that number you’re getting in times 1000

The Unix option is looking for milliseconds. That’s why you’re stuck in 1970 up there

My eyes could be deciding me at this hour

Thanks for the post. Unfortunately, Bubble doesn’t give the option to multiply a value formatted as date (UNIX).


I’m sure I could change the type for the call response, but I was hoping Bubble had some kind of native solution. Any thoughts?


1 Like

it was working for me, I’ll have to check again though.

Thanks for that, @cmarchan. I was using that feature, but I’m trying to figure out why Bubble’s Date (UNIX) type doesn’t render the same thing as the Unix Extract. For example, using that Extract from date feature renders a legitimate UNIX Epoch timestamp that is accurate.


App (Date (UNIX) on left, Unix Extract on Right):

The first stamp renders as follows when plugged in to the Epoch Converter:


Does that make sense?

This is because the Date (unix) gives you seconds where as extract Unix gives you milliseconds.

Im not sure why the inconstancy but as @jared.gibb said you then have to multiply by 1000 to put the Date(unix) into milliseconds.

I also use the Epoch converter and you can see there it says timestamp in Seconds because it is realizing it is getting seconds by looking at the length of the number.