C#获取当前日期(年月日格式) - 代码示例
在C#中,可以使用DateTime.Now.ToString("yyyy-MM-dd")来获取当前时间的年月日格式。\n\n示例代码如下所示:\n\n\nusing System;\n\nclass Program\n{\n static void Main()\n {\n string currentDate = DateTime.Now.ToString("yyyy-MM-dd");\n Console.WriteLine(currentDate);\n }\n}\n\n\n运行以上代码,将输出当前时间的年月日格式,例如"2022-01-01"。
原文地址: https://www.cveoy.top/t/topic/qmFI 著作权归作者所有。请勿转载和采集!