C # get the last day of a month and the first day

                 = strDate "2019-03" 
DateTime = DateTime.Parse a Date (strDate);
// To get the first day of the month, one day
String the FirstDay Date.AddMonths = (- 1 ) .Date.AddDays ( 1 - Date.Day). AddMonths ( 1 ) .ToString ( " yyyy-mM-dd HH: mm: SS " ); // to get the first month of the last day of one day get 59 minutes 59 seconds on the last day of the month String lastDay = DateTime.Parse (a Date .AddDays ( . 1 - Date.Day) .AddMonths ( . 1 .) .ToShortDateString ()) the AddSeconds (- . 1 ) .ToString ( " YYYY the mM-dd-HH: mm: SS " );

      

Guess you like

Origin www.cnblogs.com/Warmsunshine/p/11855396.html