Convert string into date format

Hey guys , I need your help.
Actually I want to convert a string “28/04/2021” into date format mm/dd/yyyy . And how can we compare two dates like

27/04/2021 < 28/04/2021 => True

Or

Can we convert (wed Apr 27 00:00:00 GMT+05:30 2021) into mm/dd/yyyy?

Please help me out

Use the clock blocks…

you just convert your given date into an instant by using the clock component.

1 Like

It is simple only but before proceeding Pls tell us, among these two days one is present date(we can use clock now) and another one, where is it come from? Stored date or tinyDB or firebase or something else. So we can give correct block to you.

One is current date and another one is called from firestore and stored in tinydb.

So I want to compare current date and the date that stored in tinydb.

Is this a right way to compare two dates?

Do you know how to retrieve the date from firestore? Or show us what have you tried… we wl help you with quick solution

I know how to retrieve data from firestore.

Actually I want to compare to date.one is in the format 28/04/2021 and other is in the string format “27/04/2021”.

So I want to first convert string format date into date format .
And then

27/04/2021 <= 28/04/2021 => True

Or

I also want to convert (wed Apr 27 00:00:00 GMT+05:30 2021) into mm/dd/yyyy format .

But I can’t understand how to do that

Show us how you are retrying the date from the firestore and You can modify there itself

I did nothing because I can’t understand how to convert date format .

I just want to compare two dates .

Like

27/04/2021<28/04/2021=> True

But the problem is one date out of two is in string format and first I want to convert that string format date into date format and then want to compare these dates.

And I can’t understand how to do that ?

retrieve the date from the place where you want and save it in a global variable and check that global date with clock now . simple

But the date that I retrieve is in string format not in datetime format.

Can you please give me blocks of this.

if you anyone these block depending upon how did you store the date in firstore, it will convert the sting into normal
image

This is the datetime format in firestore .

Have you added data directy in firebase or from app ?

Directly in firebase

Then when you save directly the form should be in the form shown below in order to retrieve it correctly in your app

"\"your data here\""

firebase or firestore? both are different…