SARAVAN SARAVAN - 1 month ago 18
C# Question

C# DateTime to "YYYYMMDDHHMMSS" format

I want to convert a C# DateTime to "YYYYMMDDHHMMSS" format. But I don't find a built in method to get this format? Any comments?

Answer

DateTime.Now.ToString("yyyyMMddHHmmss"); // case sensitive