Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Now I have
C#
var dateTimeFormat = "MMddhhmm"

Then we have:
C#
DateTime.Now.ToString(dateTimeFormat)

Which is "06250135". But I want "06251335".
Because it is afternoon now, the hour is 13 rather than 01.
Posted

1 solution

You should use
C#
var dateTimeFormat = "MMddHHmm";

see "Custom Date and Time Format Strings"[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900