DataFormatString Military Time

G

Guest

Hi,
You can try following two options:
[1]{"H:mm"}
Use uppercase H to display times based on the 24-hour clock (military
clock). Uppercase H displays single-digit hours as single-digit numbers,
without a leading zero.

[2]{"HH:mm"}
Use uppercase HH to display times based on the 24-hour clock (military
clock). Uppercase HH displays single-digit hours with a leading zero.

Thanks and Regards,
Manish Bafna.
MCP and MCTS.
 
P

Phillip Vong

Manish,
Thanks!!!!
In VWD, {H:mm} didn't work. I changed it to {0:H:mm} and it worked just
fine!

Thanks alot!!!
Phil

Manish Bafna said:
Hi,
You can try following two options:
[1]{"H:mm"}
Use uppercase H to display times based on the 24-hour clock (military
clock). Uppercase H displays single-digit hours as single-digit numbers,
without a leading zero.

[2]{"HH:mm"}
Use uppercase HH to display times based on the 24-hour clock (military
clock). Uppercase HH displays single-digit hours with a leading zero.

Thanks and Regards,
Manish Bafna.
MCP and MCTS.

Phillip Vong said:
Simple question from a newbie. Using VWD in VB.NET for ASP.NET.

I want to format a time value to show in military time only and without
the
seconds. I know it's not {0:t} or {0:T} but I can not figure out what it
is.
If it's 3:25 PM, I want it to show 15:25 only and without the seconds.
This
is what I found, but it did not provide me with the Military formating.

http://datawebcontrols.com/faqs/CustomizingAppearance/FormatDateTimeData.shtml

Thanks!

Phil
 
M

Mark Rae

In VWD, {H:mm} didn't work. I changed it to {0:H:mm} and it worked just
fine!

Just in case you're intending to use this in databound controls (GridView
etc) using the DataFormatString tag, you will also need to set the
HtmlEncode tag to false or it won't work...
 
P

Phillip Vong

Mark, I did exactly that.

Can someone help me format this so it's in H:mm format? I'm using this with
a button On_Click and I'm not sure what the formatting command is.
Thanks!

Dim CurTime As DateTime = DateTime.Now

TextBox1.Text = CurTime
 
P

Phillip Vong

When I try that, I get non military time like 3:31:00 PM.

Dim CurTime As DateTime = DateTime.Now.ToString("H:mm")

TextBox1.Text = CurTime
 
P

Phillip Vong

Anyone?


Phillip Vong said:
When I try that, I get non military time like 3:31:00 PM.

Dim CurTime As DateTime = DateTime.Now.ToString("H:mm")

TextBox1.Text = CurTime
 

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

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top