How To Split A Number In 2 Parts?

I am trying to add hours and minutes to a date…

I have a timezone offset arriving as a number via the bubble API.

How do I split off the last 2 characters from the number received?

Example, “-0700” should become -07 (hours) and 00 (minutes)

Or “+0300” should become +03 (hours) and 00 (minutes)


Bump on this…

How can this be done inside Bubble?

Can anyone help?


@JustinC extract with regex. For last 2 characters, use pattern ..$

I thought this may have been the answer, but I don’t see that option:


The -0700 is being received via api as a number so that i can add the hours and minutes to a date to convert the date to UTC. But I need to seperate the Hours (-07) from minutes (00).

@JustinC Above method is for text which makes it easier to deal with extracting characters. If you can return as date/time then you can do calculations like extract ‘hour’ and ‘minute’.

1 Like

You are receiving a text (string) and can split and parse this text as you want using REGEX, however you need to make the resulting text type into a number type so it may be used in a calculation. Unfortunately, bubble doesn’t do this as standard and so there are a few ‘type changing’ plugins that can do this.

Here is your regex for grabbing the first three characters

and the last 2

One plugin to convert text to number

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.