private void GetTime()
{
Debug.Log(DateTime.Now.ToString());//2023/8/25 9:55:57
Debug.Log(DateTime.Now.ToLongDateString().ToString());//转换为其等效的长日期字符串 2023年8月25日
Debug.Log(DateTime.Now.ToShortDateString().ToString());//转换为其等效的短日期字符串 2023/8/25
Debug.Log(DateTime.Now.ToString("yyyy-MM-dd"));//2023-08-25
Debug.Log(DateTime.Now.Date.ToString());//2023/8/25 0:00:00
Debug.Log(DateTime.Now.ToLongTimeString().ToString());//9:55:57
Debug.Log(DateTime.Now.ToShortTimeString().ToString());//9:55
Debug.Log(DateTime.Now.ToString("hh:mm:ss"));//09:55:57
Debug.Log(DateTime.Now.TimeOfDay.ToString());//当天的时间 09:55:57.0440208
Debug.Log(DateTime.Now.ToFileTime().ToString());//转换为 Windows 文件时间 133374021570445411
Debug.Log(DateTime.Now.Year.ToString());//获取年份 2023
Debug.Log(DateTime.Now.Month.ToString());//获取月份 8
Debug.Log(DateTime.Now.DayOfWeek.ToString());//获取星期几 Friday
Debug.Log(DateTime.Now.DayOfYear.ToString());//该年中的第几天 237
Debug.Log(DateTime.Now.Day);//该月中的第几天 25
Debug.Log(DateTime.Now.Hour.ToString());//获取小时 9
Debug.Log(DateTime.Now.Minute.ToString());//获取分钟 55
Debug.Log(DateTime.Now.Second.ToString());//获取秒数 57
Debug.Log(DateTime.IsLeapYear(2008));//指定的年份是否为闰年 True
Debug.Log(DateTime.DaysInMonth(2023, 8));//指定年和月中的天数 31
}