欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

c# 自定义日期的时分秒

程序员文章站 2022-08-09 10:19:15
1 DateTime beginTime = DateTime.Now.Date; 2 Console.WriteLine(beginTime); 3 DateTime endTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, Dat ......
1 datetime begintime = datetime.now.date;
2 console.writeline(begintime);
3 datetime endtime = new datetime(datetime.now.year, datetime.now.month, datetime.now.day, 23, 59, 59);
4 console.writeline(endtime);
5 datetime customtime = new datetime(2018,09,03,14,30,20);
6 console.writeline(customtime);

c#  自定义日期的时分秒