I have a code:
int MonthNow = System.DateTime.Now.Month; int YearNow = System.DateTime.Now.Year; int DayNow = System.DateTime.Now.Day;
How
Beware of adding an unwanted timezone to your results, especially if the date is going to be sent out via a Web API. Use UtcNow instead, to make it timezone-less.