C DateTime to YYYYMMDDHHMMSS format

0 votes
I'd like to convert a C# DateTime to the format "YYYYMMDDHHMMSS." But I can't seem to discover a built-in way for obtaining this format? Any thoughts?
Jun 11, 2022 in C# by pranav
• 2,590 points
3,457 views

1 answer to this question.

0 votes

Use this. It is case sensitive by the way.

DateTime.Now.ToString("yyyyMMddHHmmss");
answered Jun 13, 2022 by krishna
• 2,820 points