Formatting "Short Time" in VB.NET

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I use: Format(datetime, "Short Time") or Format(datetime, "t") or
Format(datetime, "hh:mm") I always get an AM/PM value on the end of the time
string. How do I get a short time in military format without AM/PM? Thanks.
Bob Hughes
 
ReHuges,

This is only for the cultures where the PM and AM are used. This format is
called in the US Military time.

In those cultures you can use "HH:mm" in the others both hh:mm and HH:mm
will work the same.

I hope this helps?

Cor
 
Try these:

Dim strTime As String = Format(DateTime.Now, "HH:mm")
MessageBox.Show(strTime, "Time Example")

Dim strTime As DateTime
MessageBox.Show(strTime.Now.ToShortTimeString, "Time Example")

I hope this helps
 
Back
Top