'I want to know how to make the date automatically change the year only in mvc
I want to know how to make the date automatically change the year only
For example, if I have this date in the database 9/21/2020 I want the year to change every year, for example, we are now 2022. The date in the database is 9/21/2022
Solution 1:[1]
In your controller you can do something like
while (myDate.Year < DateTime.Now.Year)
{
myDate = myDate.AddYears(1);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |