473,395 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 38887
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: (@varCust varchar(50)) AS SET NOCOUNT ON
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 solid 50kbs connection (dial up). This is for 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 in advance!
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 a compute cluster) - store the information as a...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...

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.