Solved

How to display seconds in NET TIME command?

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
Learn about cloud computing and its benefits for small business owners.
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…

831 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