I have read several forum posts about this without finding a solution. I also have tried to use the plugin “Data Converter” from “Copilot”, but it gives me strange results or is not working at all.
How do I convert a string like “2021-12-22” into a date so I can save it to a database field of the type date?
Hi @CosmicSelf
Playing with Date is not an easy game.
It’s better to use the good data type on input so that date be recorded in a good way.
But if you have to convert a string (text) into date you should be comfortable with javascript. Read this documentation : Date.parse()
I checked but didn’t find plugin to do so.
You should fetch the data formated in JSON, so the date is normally a timestamp.
Is this data stored in Bubble database ?
Have you tried the API Connector plugin to fetch your data ?
There a plugin available for this one. Text to Unix plugin, you need to use 2 action to complete, first things is use the action Text to Unix and then use the Unix to Date
You also can use toolbox plugin then an expression, as shown of the screenshot below. You will need to use a bit of javascript but this works very well.
You need to use expression’s result where you want to use converted date.
Note that you can use server script from the same plugin if you need to do the action in the backend.
use o arbitrary date/time e depois mude o dia, mês e ano com dados do texto.
ex.: 01/01/2023 split ‘/’ = 01 , 01, 2023 . item 1 = 01 item 2 = 01 item 3 = 2023.
não esqueça de converter o texto para numero
I see your response when I am looking for a solution to my faced issue. How do I use this expression results, and how do I access it? I want to store it in DB.