DateTime dtNow = DateTime.Now; string mon1 = dtNow.ToString("yyyy-MM-dd hh:mm:ss");//MM为月份,hh为12小时制 string mon2 = dtNow.ToString("yyyy-mm-dd HH:mm:ss");//mm为分钟,HH为24小时制 Console.WriteLine(mon1); Console.WriteLine(mon2);
2022-11-02 19:57:42
DateTime dtNow = DateTime.Now; string mon1 = dtNow.ToString("yyyy-MM-dd hh:mm:ss");//MM为月份,hh为12小时制 string mon2 = dtNow.ToString("yyyy-mm-dd HH:mm:ss");//mm为分钟,HH为24小时制 Console.WriteLine(mon1); Console.WriteLine(mon2);
下一篇:特效时钟