Compare todays date with date of birth

Hi,
I need to check date of birth is greater than today or not.
For example my date of birth will be in “22/07/1993” we need to compare with today date and check whether it is greater than or less than.

Please help me with the logic or code.

I tried in this way, getting date, month in different variable and converting them to integer. DOB date<now.tostring(“dd”).tostring and DOB month<=now.tostring(“MM”).tostring.
But this will not satisfy my logic.
So I need a logic will satisfy my requirement.

Thanks

1 Like

Hi @hemanth_chinna,
Here i have attached the xml to check the date comparison. It has 2 sequences.

Compare todays date with date of birth.zip (2.4 KB)

Regards
Balamurugan.S

@hemanth_chinna
Try this.It gives -1 if DOB is lesser than today and gives 1 if greater.I have used “compareto” method here. :slight_smile:
Happy Coding!! :slight_smile:
DateCompare.zip (1.8 KB)

Regards,
Puja

Thank you so much for your response @puja_padhy and @balupad14
Is there any option to check number of years, such as “22/07/1993” this is the date of birth.
We need to find number of years completed.

Thank you so much.

Here you go :slight_smile:

YearDiff.xaml (6.5 KB)

Regards,
Puja