Hello!
I’m new and confused with the date formatting. I have an API that gives me back a field date = 20190405
, how would I parse / transform this into a date? I tried with Formatted as but without success.
Hello!
I’m new and confused with the date formatting. I have an API that gives me back a field date = 20190405
, how would I parse / transform this into a date? I tried with Formatted as but without success.
Hey @loris
There may well be other ways to do this, and this method may not suit your needs either, but here is one possible way which uses the Expression element (from the toolbox plugin). I don’t know it’s possible to do this straight up using Bubble features, not without the use of JavaScript anyway. Might be able to use regex.
I created myself a custom state called “date-text” and made it a String object.
I then fed that value into the Expression which converted it to a Date object.
Afterwards, I show the value of the Expression element.
See below.
Because you only have the yyyymmdd, the time will default to 12:00 am.
Hope it helps.
Thanks so much @pork1977gm, it’s actually working well, so I won’t search for others ways to do it
No probs, happy to help
@pork1977gm
I also wanyt to format the text in particular format. Can you please look into my post.
There is a plugin String to thing / things Plugin | Bubble that might help.
Preview:
https://just4tests8.bubbleapps.io/version-test/text_to_date
username
password
Editor:
@lottemint.md
For conversion i’m using Expression element from toolbox plugin.
in first screenshot you can see creating new Date().
Then in text element i’m formatting it in a custom format.
The final result in the text element where time is not formatting.
can you attach a raw example of it?
Thank you but issue has been resolved.