473,657 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataFormatStrin g Military Time

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/Cust...TimeData.shtml

Thanks!

Phil
Dec 19 '06 #1
8 21785
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" wrote:
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/Cust...TimeData.shtml

Thanks!

Phil
Dec 19 '06 #2
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" <Ma*********@di scussions.micro soft.comwrote in message
news:9D******** *************** ***********@mic rosoft.com...
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" wrote:
>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/Cust...TimeData.shtml

Thanks!

Phil

Dec 19 '06 #3
"Phillip Vong" <phillip_vong*a t*yahoo*dot*com wrote in message
news:e4******** ******@TK2MSFTN GP04.phx.gbl...
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 DataFormatStrin g tag, you will also need to set the
HtmlEncode tag to false or it won't work...
Dec 19 '06 #4
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


"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:uH******** ******@TK2MSFTN GP06.phx.gbl...
"Phillip Vong" <phillip_vong*a t*yahoo*dot*com wrote in message
news:e4******** ******@TK2MSFTN GP04.phx.gbl...
>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 DataFormatStrin g tag, you will also need to set the
HtmlEncode tag to false or it won't work...

Dec 19 '06 #5
"Phillip Vong" <phillip_vong*a t*yahoo*dot*com wrote in message
news:us******** ******@TK2MSFTN GP02.phx.gbl...
Can someone help me format this so it's in H:mm format?
Dim CurTime As DateTime = DateTime.Now.To String("H:mm")

TextBox1.Text = CurTime
Dec 19 '06 #6
When I try that, I get non military time like 3:31:00 PM.

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

TextBox1.Text = CurTime

"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:%2******** **********@TK2M SFTNGP06.phx.gb l...
"Phillip Vong" <phillip_vong*a t*yahoo*dot*com wrote in message
news:us******** ******@TK2MSFTN GP02.phx.gbl...
>Can someone help me format this so it's in H:mm format?

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

TextBox1.Text = CurTime

Dec 19 '06 #7
"Phillip Vong" <phillip_vong*a t*yahoo*dot*com wrote in message
news:uv******** ******@TK2MSFTN GP06.phx.gbl...
When I try that, I get non military time like 3:31:00 PM.
Hmm - OK, that's a little strange. That's definitely the correct way to do
it, though:
http://msdn2.microsoft.com/en-us/lib...d4(VS.80).aspx
Dec 19 '06 #8
Anyone?
"Phillip Vong" <phillip_vong*a t*yahoo*dot*com wrote in message
news:uv******** ******@TK2MSFTN GP06.phx.gbl...
When I try that, I get non military time like 3:31:00 PM.

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

TextBox1.Text = CurTime

"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:%2******** **********@TK2M SFTNGP06.phx.gb l...
>"Phillip Vong" <phillip_vong*a t*yahoo*dot*com wrote in message
news:us******* *******@TK2MSFT NGP02.phx.gbl.. .
>>Can someone help me format this so it's in H:mm format?

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

TextBox1.Tex t = CurTime


Dec 21 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
31097
by: Al | last post by:
Hi Is it a function to convert time to and from military time? Thanks
4
2679
by: richardkreidl | last post by:
How would I check to see if the current time(military format) is greater then 07:30AM and the day of the week is Monday-Friday. Pseudo code: If Current_Time > 07:30AM and Current_Day = Monday or Current_Day = Tuesday _ or Current_Day = Wednesday or Current_Day = Thursday or Current_Day = Friday then
5
4800
by: Scott | last post by:
If I have a datetime sql field with afternoon datetime values like below in DATETIME VALUE, how can I display the time part in ASP as 1:00 PM, instead of 13:00 PM as seen in CURRENT RESULTS below? Currently, I'm getting my CURRENT RESULTS by using the HOUR() function. Is there a way to display just the time part in "non-Military" time format? DATETIME VALUE: 2006-01-24 13:30:00.000
1
6360
by: ApexData | last post by:
Hello Any know how to convert AM/PM Time to 24Hr Time ? Sample Please ! With and without Now(). ThankYou Greg
3
5062
by: wocosc | last post by:
I have a quick question.. How can get python to take whatever time of day it is, and output it as military time? I already know how to get it to return the specific time.
8
6983
AccessIdiot
by: AccessIdiot | last post by:
Argh! This is driving me crazy. My db users want to be able to enter a string of numbers for hours, minutes, seconds, in military time format (021256 for 2:12:56 a.m. and 152416 for 3:24:16 p.m.). They don't want to have to specify am or pm and don't want to have to type colons. I can't seem to create this input mask myself for some reason and the one that comes with Access doesn't have seconds. Help?
1
19947
by: okaymy1112 | last post by:
I have data in this format 0800, 1730, 0930, etc. I do not know how to convert this time to read something like, 8:00AM, 5:30 PM, 9:30AM etc. Also I want to group things by day. I have courses taken on different days of the week at different time. E.g. Math02 on Wednesday at 8:30 AM to 11:30AM. So I want to show Time of Day, (eg 6:30 AM - 9:00 AM) Day (eg Monday) ad group the courses taken by day and time. Please assist Thanks O
4
13183
by: drg | last post by:
My assignment is actually encapsulation which is not the problem -- my program needs to take two military times and calculate the minutes elapsed between the two. I have everything worked out so far except how to convert the military time from a string to an int. Or should I be casting instead? Student needs help. thanks,
1
4895
by: mdthom08 | last post by:
I can't figure out the formula to convert military time all to minutes.
0
8413
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7352
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.