Solved

How to display seconds in NET TIME command?

Posted on 2008-10-30
4
3,848 Views
Last Modified: 2012-05-05
I need to create a command file that checks the time (HHMMSS at least) on a remote server. When I issue a NET TIME command, I get the hours and minutes only. I need the seconds to display as well. Can you tell me how to do this (with cmd or vbs)?
0
Comment
Question by:bobgato111
  • 3
4 Comments
 
LVL 59

Expert Comment

by:Darius Ghassem
ID: 22846620
0
 
LVL 17

Expert Comment

by:Jared Luker
ID: 22847391
You can just type 'time /T' and hit enter.  It produces the seconds output:

The current time is: 21:13:54.46

With VBScript, you can use the NOW command and it will produce output like this:

10/30/2008 9:16:24 PM
wscript.echo Now

Open in new window

0
 
LVL 17

Expert Comment

by:Jared Luker
ID: 22847412
It looks like time /t does not display the seconds.  Time all by itself will output the seconds, but then issues a prompt for a new time, so that's probably not what you want.  

I would use VBScript since it's so much more flexible.
0
 
LVL 17

Accepted Solution

by:
Jared Luker earned 500 total points
ID: 22847419
You can also use 'echo %time%' in a batch file.  That will also give you a seconds reading.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question