472,331 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 software developers and data experts.

how to get HH:mm:ss format of Now.ToShortTimeString?

Now.ToShortTimeString returns 9:13 PM.

I would like to get this in miliatry time with seconds included 21:13:45
(or something like that - just military time with seconds). How can this be
done?

Thanks,
Rich
Nov 21 '05 #1
4 38546
Capitilize the hours:

Dim dtTime As String = Format(DateTime.Now, "HH:mm:ss")
MessageBox.Show(dtTime)

I hope this helps,

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #2
Thanks for your replie. Actually, I was using that, but just checking if
there was a different way where I did not have to precede Now... with Format.
Here is what I came up with that seems to do the trick

Now.ToString("HH:mm:ss")

It is a C# method, but C# and VB.Net are pretty much the same now except for
Dim and you have modules in VB (and no { } or ; ...)

"Crouchie1998" wrote:
Capitilize the hours:

Dim dtTime As String = Format(DateTime.Now, "HH:mm:ss")
MessageBox.Show(dtTime)

I hope this helps,

Crouchie1998
BA (HONS) MCP MCSE

Nov 21 '05 #3
"Rich" <Ri**@discussions.microsoft.com> schrieb:
Now.ToShortTimeString returns 9:13 PM.

I would like to get this in miliatry time with seconds included 21:13:45
(or something like that - just military time with seconds). How can this
be
done?


\\\
MsgBox(Now().ToString("HH:mm:ss"))
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4
On Mon, 11 Jul 2005 10:11:04 -0700, Rich wrote:
Now.ToString("HH:mm:ss")

It is a C# method, but C# and VB.Net are pretty much the same now except for
Dim and you have modules in VB (and no { } or ; ...)


It's actually a standard method of the Datetime class, available for all
languages. Datetime is the return type of the Now() function.
Nov 21 '05 #5

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

Similar topics

6
by: KathyB | last post by:
Hi, not too swift with anything other than simple SQL statements, so I'm looking for some help. Using SQL Server 2000 with this stored proc: ...
2
by: D. Shane Fowlkes | last post by:
Here's a good one. I've been using an Excel spreadsheet for the past couple of years to calculate a file's Estimated Download Time based off of a...
14
by: Michael Barrido | last post by:
I have this for example: Dim iSeconds as int32 = 3600 '3600 seconds is one hour How do i convert it to "01:00:00" ? Please help. Thanks...
15
by: Jay Tee | last post by:
Hi, I have some code that does, essentially, the following: - gather information on tens of thousands of items (in this case, jobs running on...
1
by: Vishal Bhargava | last post by:
Is there an inbuilt library in Python which you can use to convert time in seconds to hh:mm:ss format? Thanks, Vishal
1
by: chindanoor | last post by:
Here is my code... class TimeConverter { public static void main(String ar) { int sec=3650; int min=0; int hour=0; while(sec>=60)
2
by: smitanaik | last post by:
hi i want to do validation of datetime in javascripti.e is i want it in this format dd:mm:yyyy:hh:mm:ss plz heklp me out its urgent
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.