主要代碼:
DateTime.Now.ToString("yyyyMMdd HH:mm:ss") //獲取系統當前時間,使用yyyyMMdd HH:mm:ss 格式作為字符串展示
代碼:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace obge { class Program { static void Main(string[] args) { Console.WriteLine(DateTime.Now.ToString("yyyyMMdd HH:mm:ss")); //由於會一閃而過,所以在加一個輸入 string name; Console.WriteLine("請輸出你的名字:"); name = Console.ReadLine(); Console.WriteLine(name); } } }