List of dates & times as text in a backend workflow, is Regex the answer?

Hey Bubblers,

I have a table of imported data that contains dates as a string that I want to convert in a backend workflow.

It’s currently in the format
yyyy-mm-ddTHH;MM;SS and looks like this:
2022-09-01T14:14:00

I’m making other changes to the data record by record recursively so can add a step to my Make Changes to Thing and create a proper date field to store this. Just not sure of the right approach.
One possible solution was Regex which I’m new to.

Using https://regex101.com/ I found the
expresion

(\d+)[-](\d+)[-](\d+)[T](\d+)[:](\d+)[:](\d+)

or possibly

(\d+)–T::

This gives me what I need but this is then a list of 6 things. How do I match these items to each element in the Date/Time field?

Would prefer convert to this directly rather than send to a plugin as Im running this over a couple of thousand records but any suggestions are welcome.

Thanks in advance!
John

Hi @johnnyweb :wave:

Take a look here:

I think that if you edit your text to match the format above, Bubble will understand the text as date and you will be able to save it as date. Remember that you need to enable this feature in your editor (Settings → Versions).

1 Like

Hey thanks @rpetribu :+1: that fixes my my time zone issues

So now I need to get the date time fields converted from text, not sure how to achieve this with Regex

Here’s the solution for anyone interested. I’ve left Regex in the end and used Data converter plugin - Text to Date converter as below. Weirdly their instructions don’t mention time so I figured it only did the date part of the time calc (yes I know date type has day and time) .

image
I also tried @rpetribu ‘s suggestion using the timezone as an option but this gave me weird results Being GMT+10 if I entered my timezone this sent me forward 20 hours, I also tried GMT and GMT-10 but it also didn’t’ work so in the end I’ve rounded down and will just watch it when we switch to daylight savings.
I ended up using this
image
and the process works well in a backend workflow

2 Likes

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