Forum Academy Marketplace Showcase Pricing Features

Date Time Calculations

Hi Team,

I’m getting a date and time out of an API call in a JSON response that looks like this:
“remind_date”: “2022-12-09”,
“remind_time”: “11:45”,

What is the easiest way to convert those text strings to a time/date format that Bubble understands and I can then use to calculate the number of days/hours/minutes to/from the current date and time?

Cheers

You could do Arbitrary date, type a random date like 1/1/2023, then do a ton of operators chained one after the other like
:change years to remind_date:split by "-":first item:converted to number
:change month to remind_date:split by "-":item #2:converted to number
:change date to remind_date:split by "-":last item:converted to number
:change hours to remind_time:split by ":":first time:converted to number
:change minutes to remind_time:split by ":":last item:converted to number

Change the return value from text to date