473,503 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting to military time

Al
Hi

Is it a function to convert time to and from military time?
Thanks

Nov 21 '05 #1
2 31030
On Thu, 4 Nov 2004 10:46:29 -0800, "Al" <Al@discussions.microsoft.com>
wrote:
Hi

Is it a function to convert time to and from military time?
Thanks


Theres a whole bunch of things to do with time using "now"
Eg.

msgbox(now.ToUniversalTime)

Will give you the current UTC regardless of your timezone.
if you want it in 24-hour clock:

format(now.ToUniversalTime,"HH:mm:ss")

(captial HH for 24 hours)

Nov 21 '05 #2
Al
DateTime always stores "time" in 24 hour (military time) format. It just
varies how you display it.

As Scott suggests you can use a custom format to change how time is
displayed & parsed.

Const militaryTimeFormat As String = "HH:mm"

' convert to a string in military time
Dim input As String = DateTime.Now.ToString(militaryTimeFormat)

' convert from a string in military time
Dim time As DateTime = DateTime.ParseExact(input,
militaryTimeFormat, Nothing)
For details on custom datetime formats see:

http://msdn.microsoft.com/library/de...matstrings.asp

For information on formatting in .NET in general see:
http://msdn.microsoft.com/library/de...ttingtypes.asp

Hope this helps
Jay

"Al" <Al@discussions.microsoft.com> wrote in message
news:74**********************************@microsof t.com...
Hi

Is it a function to convert time to and from military time?
Thanks

Nov 21 '05 #3

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

Similar topics

4
2674
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...
5
4793
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?...
1
6354
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
23
2614
by: Reggie | last post by:
Hi and TIA. I developed several A2K dbs which are now being run on my clients computer which have been upgraded to Access 03. I'm not sure exactly what they mean but of you know or could point me...
8
21760
by: Phillip Vong | last post by:
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...
3
5019
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.
4
13153
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...
2
3126
by: Renee Zarazinski | last post by:
I have two fields Time-in & Time-out that are in military time. I have to calculate the difference (to get the total amt. of time spent working) then show the time as clock time. I've only been...
0
7202
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,...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
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,...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
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,...
1
5014
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...
0
3167
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...
0
1512
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 ...
0
382
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...

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.