using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HMI.Util { public class DateUtil { public static void GetDayTime(out DateTime start, out DateTime end) { DateTime currentTime = DateTime.Now; start = new DateTime(currentTime.Year, currentTime.Month, currentTime.Day, 0, 0, 0); end = new DateTime(currentTime.Year, currentTime.Month, currentTime.Day, 23, 59, 59); } public static void GetWeekTime(out DateTime start, out DateTime end) { DateTime currentTime = DateTime.Now; start = currentTime.AddDays(1 - 7); start = new DateTime(start.Year, start.Month, start.Day, 0, 0, 0); end = currentTime.AddDays(7 - 7); end = new DateTime(end.Year, end.Month, end.Day, 23, 59, 59); } public static void GetMonthTime(out DateTime start, out DateTime end) { DateTime currentTime = DateTime.Now; start = new DateTime(currentTime.Year, currentTime.Month, 1, 0, 0, 0); end = start.AddMonths(1).AddDays(-1); end = new DateTime(end.Year, end.Month, end.Day, 23, 59, 59); } } }