static void Main(
string[] args)
{
Console.WriteLine("*********");
UseDatesAndTimes();
Console.ReadLine();
}
private static void UseDatesAndTimes()
{
DateTime dt =
new DateTime(
2010,
10,
17);
//一个月中的哪一天
Console.WriteLine(
"tht day of {0},is {1}", dt.Date, dt.DayOfWeek);
//增加月份
dt = dt.AddMonths(
2);
Console.WriteLine("day light saving {0};{1}", dt.IsDaylightSavingTime(),dt.Month);
//构造函数接受小时,分钟,秒
TimeSpan ts =
new TimeSpan(
4,
30,
0);
Console.WriteLine(ts);
//从当前减去15分钟
Console.WriteLine(ts.Subtract(
new TimeSpan(
0,
15,
0)));
}
转载于:https://www.cnblogs.com/luckystar2013/archive/2013/04/27/3046696.html
相关资源:JAVA上百实例源码以及开源项目