Home >Backend Development >C#.Net Tutorial >How to convert C# DateTime to 'YYYYMMDDHHMMSS' format?
Convert the date and time to toString, thereby converting the date and time to the "YYYYMMDDHHMMSS" format
The date and time can also be converted into other formats
MM/dd /yyyy 08/22/2020
dddd,dd MMMM yyyy Tuesday, August 22, 2020
dddd, dd MMMM yyyy HH:mm Tuesday, August 22, 2020 06:30
dddd, dd MMMM yyyy hh:mm tt Tuesday, August 22, 2020 06:30 AM
dddd,dd MMMM yyyy H:mm Tuesday, August 22, 2020 6:30
dddd,dd MMMM yyyy h:mm tt Tuesday, August 22, 2020 6:30 AM
dddd, dd MMMM yyyy HH:mm:ss Tuesday, August 22, 2020 06:30:07
Month/Day/Year Hour:Minutes 08/22/2020 06:30
Month/Day/Year Hour:Minutes tt 08/22 / 2020 06:30 AM
year/month/dayH:mm2020年8月22日6:30
year/month/day Hour: Minute tt 08/22/2020 6:30 AM
MM/dd/yyyy HH:mm:ss 08/22/2020 06:30: 07
Live demonstration
class Program { static void Main() { DateTime d = DateTime.Now; string dateString = d.ToString("yyyyMMddHHmmss"); System.Console.WriteLine(dateString); Console.ReadLine(); } }
20200727080325
The above is the detailed content of How to convert C# DateTime to 'YYYYMMDDHHMMSS' format?. For more information, please follow other related articles on the PHP Chinese website!