DateTime 25 years ago from today

in C #, how do you calculate the date 25 years ago from today?

+6
source share
2 answers

How about using AddYears :

 DateTime then = DateTime.Today.AddYears(-25); 
+20
source

That should do the trick

 DateTime.Now.AddYears(-25) 
+7
source

Source: https://habr.com/ru/post/896719/


All Articles