How to get Windows Command prompt to display time?



When it comes to using the Windows Command Prompt, administrators often need to check the current time in order to troubleshoot or perform certain tasks. Unfortunately, the Command Prompt does not display the current time by default. In this article, we will describe how to get the Windows Command Prompt to display the time.

The first step in getting the Command Prompt to display the time is to open the Command Prompt window. This can be done by typing \cmd\ into the search bar on the Windows Start Menu, or by selecting the Command Prompt icon from the Start Menu. Once the Command Prompt window is open, you will need to enter the following command:

prompt $t

This command will add the current time to the Command Prompt window every time it is opened. Note that this command will only work if you are using Windows 8, 8.1, or 10. If you are using an earlier version of Windows, you will need to use the following command instead:

prompt $s$p$g

This command will add the current time and date to the Command Prompt window every time it is opened.

Once you have entered the appropriate command, the time will be displayed in the Command Prompt window like this: [HH:MM:SS]

Where HH stands for the hour, MM stands for the minute, and SS stands for the second.

It is also possible to customize the time format in the Command Prompt window. To do this, you will need to use the following command:

prompt $t$h

Where $h is the time format you wish to use.

The available time formats are as follows:

• $h - Displays the hour in 12-hour format (e.g. 12:00 PM)

• $H - Displays the hour in 24-hour format (e.g. 14:00)

• $m - Displays the minutes (e.g. 00)

• $s - Displays the seconds (e.g. 00)

• $p - Displays AM or PM

• $a - Displays the day of the week (e.g. Monday)

• $d - Displays the day of the month (e.g. 01)

• $M - Displays the month (e.g. January)

• $y - Displays the year (e.g. 2021)

If you wish to display multiple time formats, you can simply add them together. For example, if you wanted to display the hour in 12-hour format, the minutes, and the day of the week, you could use the following command:

prompt $h$m$a

This command will display the time like this: [12:00 PM Monday]

It is important to note that the time will only be updated when the Command Prompt window is opened. If you wish to update the time more frequently, you can use the following command:

prompt $t$h && cls

This command will update the time and clear the Command Prompt window every time it is opened.

Finally, if you wish to remove the time from the Command Prompt window, you can use the following command:

prompt $s

This command will remove the time from the Command Prompt window.

In conclusion, getting the Windows Command Prompt to display the time is a fairly simple process. All you need to do is open the Command Prompt window, enter the appropriate command, and the time will be displayed in the Command Prompt window. You can also customize the time format and update the time more frequently if needed.

Inquire Now

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Find your next full or part-time role here

ScaleDesk can either help you find your next full time gig or a part time side gig where you can create extra income!

Onboard with us once
Skip HR screening and go to the final interview with with only your resume and a video interview you never have to redo
Get paid electronically every month for the hours you work
We will be your reference even if you work for us once

IT Teams: Use ScaleDesk to augment your team

Schedule Demo