program.cs
来自「csharp课本的源代码」· CS 代码 · 共 24 行
CS
24 行
using System;
using System.Collections.Generic;
using System.Text;
namespace ShowDataTimeExample
{
class Program
{
public static void Main()
{
string[] weekDays ={ "星期日","星期一","星期二","星期三",
"星期四","星期五","星期六"};
DateTime now = DateTime.Now;
string str = string.Format("{0:现在是yyyy年M月d日,H点m分},{1}",
now, weekDays[(int)now.DayOfWeek]);
Console.WriteLine(str);
DateTime start = new DateTime(2004, 1, 1);
TimeSpan times = now - start;
Console.WriteLine(
"从{0:yyyy年M月d日}起到现在已经过了{1}天!", start, times.Days);
Console.ReadLine();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?