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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top