Way to get the date YYYY-MM-DD without time?

Hello everybody,
I need to recover the current day, but in this format: YYYY-MM-DD
I thought a workaround using short date characteristics (year number + month number + day number), like so:

Result:
Schermata 2023-01-10 alle 23.31.12

But that’s not good, the first nine months (1,2,3,4,5,6,7,8,9) only show one digit!!! I also need the zero in front! Example: 2023-01-10

I can’t set fixed zero before the month, because then the result would be (from October to December only): 2023-012-15 (example).

It would be great to use the unformatted date that adalo has, but without the time!

Can anyone advise me what to do to solve the problem? Is it possible to get unformatted date without time? I need it in format YYYY-MM-DD

Thanks to all!

You could use a string fuction to trim it to 10 characters max length. I believe you can do that with the arbitrary javascript component, zapier, or similar.

Thanks for the reply. i need to pass this data (yyyy-mm-dd) through an api call, to an external service. therefore it must not simply be printed on screen. do you think it is possible?

Yes, if you use a custom action which cuts it down to 10 characters, you can use the response to that custom action in your API call.

Hello Nathan, would you be so kind as to provide an example?

Giuseppe with JavaScript!

JS
var date = new Date();
var format = date.toISOString().slice(0, 10);
return format
Component Details

You need the Arbitrary Javascript component made by Pragmaflow. Nowadays there’s a error when downloading components from their site. For download them you can follow these steps : Every new beginning comes from some other beginnings end - #48 by James_App_Maker And Pragmaflow created a video of this way too : Installing Adalo Github components walkthrough - YouTube

Also you can use a API like @Abracadalo as Nathan mentioned! : String API | Abracadalo API Handbook

Thank you

1 Like

Thanks so much man!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.