Convert unix time to date field

@telaholcomb, that value appears to be a timestamp in milliseconds, and that’s what Bubble already uses internally to represent dates.

I would suggest setting the timestamp field in the API call to be of type “date”. (You could also test it with your input element by changing its type to “date” instead of “integer” as shown below.)

Screen Shot 2021-03-23 at 4.13.25 PM

1 Like

That was it! I was pulling it type integer instead of date. I corrected this in the API settings and it’s good to go. THANK YOU @sudsy!

1 Like

@emmanuel what would be a great solution here would be to add to the number operator of formatted as a date choice

3 Likes

What I have done to make things a bit easier to convert as often as I would need to is created an Option for the conversion

Then I can just use that option value and add seconds to be equal to the Stripe created value (seconds) and it works well enough

Screen Shot 2021-04-29 at 6.20.21 PM

2 Likes

I have installed this plugin (confirmed it is installed) but I cannot find it in my plugin list, I have manually looked through all plugins but nothing? Anyone know what I should be looking for?

Screenshot 2022-04-18 084705

@darren.james7518

This plugin only contains a Data Call… (as shown on the plugin info)…

So you need to use ‘Get Data From External API’ to use it.

1 Like

Ah that’s cool, thanks @adamhholmes

perfect… thank you!

How would i change stripe subscription webhook response that gives current period ends and current period start number to date in backend workflow. as no plugin would work in backend workflow

I generally use this plugin:

Unix time converter Plugin | Bubble

1 Like

ok so what i did is i used toolbox plugin and when i get response from stripe webhook i run server script like below

const unixTimestamp = data.toString().trim();

const milliseconds = unixTimestamp * 1000 ;

const dateObject = new Date(milliseconds);

const humanDateFormat = dateObject.toLocaleString();

humanDateFormat;

which returns the date from unixtimestamp that stripe sends.

and then i save it to my database for future references :slight_smile: