alielie
2026-03-02 12e606635c42ea20f4b7c2bdda5204237a4b4c96
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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);
        }
    }
}