How to Compare two date

Hi Guys,
I respectfully request about this solution.

I want to compare two dates,one is with String (Nov/11/2018) and the another is Integerr (11/11/2018).

I have to used this .

Convert.ToDateTime(dt.ToString(“dd/MM/yyyy”)),where dt is DateTime variable.

But I can’t use convert function .
How can I do anotherr way?

Best Regards ,
Lwin Moe Aung

1 Like

Hi @LwinMoeAUNG

See this

Compare dates

Thanks,
Prankur

Thank you for your reply…

Sorry bro…
I means that I want to compare “Nov/11/2018” and “11/112018”.Not “Nov/11/2018” and “Nov/11/2018”.

Thanks
Lwin Moe Aung

You can use Convert.ToDateTime(your-string-date-variable) and assign it to a variable (let say monthVar).

After that you can get the month by using monthVar.Month and compare it with second-date.Month

Alternatively you could go the convoluted way and create an array of months and compare the index+1 of the array with your integer month.

Thanks bro.I got it.:grinning:

Main.xaml (5.9 KB)

1 Like

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