SARAVAN SARAVAN - 1 year ago 144
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 Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download