Check the year condition

convert.ToDateTime(vFirstDOS.ToString).Year.ToString
where vfirstDOS is the date, i want the data before lessthan 2020 year

in what format is vfirstDOS? eg 15/02/2021

what im getting at is, you can simply split the date by “/” and get the year from that date and compare with 2020. i think that would be easier to develop

“/” yes, can you provide exact code
with this code i get the year, convert.ToDateTime(vFirstDOS.ToString).Year.ToString
".year already gives the year:

Hi @ashishmani You mean do you want subtract 1 year(2019) from that date?

not 1 , i want 2019 data only , so from year want to apply condtion

@ashishmani Can elaborate your requirement clearly?

in your if activity just use this condition:

CInt(convert.ToDateTime(vFirstDOS.ToString).Year.ToString) < 2020

You can check like below code

Convert.ToDateTime(vFirstDOS.ToString).Year < 2020