Tutorial :Aribitrary System.DateTime to four character military time string



Question:

How would I convert an arbitrary System.DateTime to a four character military time string.

  • Example 1: 7am would be "0700"
  • Example 2: 2pm would be "1400"

Thanks!


Solution:1

Wouldn't

DateTime.Now.ToString("HHmm")   

do what you need?


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »