how get yesterday and tomorrow datetime in c#

后端 未结 9 1272
Happy的楠姐
Happy的楠姐 2020-12-13 08:17

I have a code:

int MonthNow = System.DateTime.Now.Month;
int YearNow = System.DateTime.Now.Year;
int DayNow = System.DateTime.Now.Day;

How

9条回答
  •  Happy的楠姐
    2020-12-13 09:10

    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.

提交回复
热议问题