guys
I have the input date is this : 10/11/2020 and my output should be : 10/11/ 2019
how to do this using vb.net or C#.net
CodePudding user response:
Use the dateadd function
Dim d As Date = DateAdd(DateInterval.Year, -1, Cdate("10/11/2020"))
Msgbox(Format(d, "dd-MM-yyyy"))
Or as the comments say, you can use AddYears
Dim d As Date = Cdate("10/11/2020").AddYears(-1)
Msgbox(Format(d, "dd-MM-yyyy"))