14

Recently I worked a lot with the command prompt. Now I want to know if it is possible to change the date and time of the system (Windows 10), only with the command prompt and how I can do it.

2
  • Have you tried with the date and time commands?
    – Magnus
    May 29, 2017 at 14:10
  • No , i haven't tried a lot , because i want to be sure about what i do May 29, 2017 at 14:26

2 Answers 2

11

Open a command prompt window. I don't think it requires administrative privileges, but if it says Access Denied after you attempt to change the date/time, close the window and reopen with administrative privileges.

With the command prompt open, type date and press enter. It asks you to enter a new date. Do so and press enter again.

Now type time and press enter. It asks you to enter a new time.

If at either of these prompts, you press enter without entering a new date/time, the date/time will not be changed.

enter image description here

0
0

Step 1: Identify the date format

Check the date format before you update, by typing the following in cmd prompt

date

In the output, you will see the date along with option to enter new date which shows the format as follows:

The current date is: Sat 07/31/2021
Enter the new date: (mm-dd-yy)

Step 2: Update Date

Now, it is evident that my pc has mm-dd-yy so in order to update date, you can put the following or the format that matches the date format on your PC, in a batch file or run via cmd prompt to set to date having format mm/dd/yyyy

date 04/14/2020
7
  • 1
    -1 because the date format will be different depending on your locale. For example, I would have to type date dd-mm-yyyy, others may have to type date yyyy/mm/dd
    – LPChip
    Sep 9, 2020 at 11:26
  • @LPChip sounds like you think so just because you think it's logical :) But MS documentation disagrees, the format is always month-day-year, separated by hyphens, slashes or dots. docs.microsoft.com/en-us/windows-server/administration/… Jul 30, 2021 at 15:25
  • @FedericoRazzoli No its not. I speak of experience. You linked to documentation with the en-us language, yes then it is using the english notation. But if you refer to the same documentation in dutch locale: nl-nl, you'll see it is dd-mm-yyyy.
    – LPChip
    Jul 30, 2021 at 17:02
  • @LPChip Err, no, you made me check for nothing :) And it's not just English and Dutch, but Italian and Spanish. Also, documentation is written for all users not for a specific locale. docs.microsoft.com/nl-nl/windows-server/administration/… Jul 31, 2021 at 1:29
  • 1
    @FedericoRazzoli Okay, so apparently the tech documentation on microsoft.com is incorrect. On my local system which is also dutch, if I type date or date /t it both tells me that the date is in format dd-mm-yy and that I have to enter it as such. I even tried to enter date 01/31/2020 as it is the only way to write januari 31st, 2020 and it complains it is an invalid date. I've provided a picture in my answer.
    – LPChip
    Jul 31, 2021 at 11:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .