Solved

How to display seconds in NET TIME command?

Posted on 2008-10-30
4
3,827 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

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…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now