⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class1.cs

📁 原代码详细说明是关于c++方面的希望可以帮助大家使用
💻 CS
字号:
using System;

namespace Exam1_1
{
	class Test
	{	
		static void Main(string[] args)
		{
            DateTime d1=new DateTime(
				2006,//Year
				12,  //Month
				31,  //Day
				12,  //Hour
				2,   //Minute
				3,   //Second
				15   //Millisecond
				);
			DateTime d2=new DateTime(2006,12,5);
			DateTime d3=DateTime.Now;//取出当前的日期和时间
			Console.WriteLine("{0:F}",d1);
			Console.WriteLine("{0}",d2);
			Console.WriteLine("{0}--{1}--{2}--{3}",d1.Year,d1.Month,d1.Day,d1.DayOfWeek);
            TimeSpan ts1=d1.TimeOfDay;//当天的时间
            TimeSpan ts2=d1-d2;
			Console.WriteLine("{0}--{1}--{2}",ts1,ts2,ts2.Days);
            string s1=d1.ToLongDateString();
			string s2=d1.ToShortDateString();
			string s3=string.Format("{0:yyyy-mm-dd}",d2);
			Console.WriteLine("{0}--{1}--{2}",s1,s2,s3);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -