2

Whenever I try to echo %date% on my machine (Windows7) the output is always the day:

C:\> echo The output is: %date%
The output is: Tue

However, when I try this to other machines (Windows 7) the output is different:

C:\> echo The output is: %date%
The output is: Tue 06/06/2017

Anyone had experienced this issue? Any suggestion?

Thanks!!!

10
  • Do a set "date=" and try again. Looks like you created a variable %date% by mistake, which overrides the systemvariable. Commented Jun 6, 2017 at 8:10
  • 1
    go to the control panel -> regional settings and check your date format. Date command is dependent on the registry/control panel settings. Commented Jun 6, 2017 at 8:12
  • As @npocmaka said, it looks like you have a custom short date format. On the "Format" tab, click on "Additional setttings...", and on the "Date" tab check the "Short date" entry. It's probably "ddd" for the three-day abbreviation of the day of the week. Commented Jun 6, 2017 at 9:02
  • FYI, for cmd.exe in Windows 10, what happens here is that cmd!GetEnvVar implements this pseudo-environment variable (it is not a system environment variable) via cmd!PrintDate, which gets the user default locale via GetUserDefaultLCID and the LOCALE_SSHORTDATE format via GetLocaleInfo. Then it formats the date string via GetDateFormat. Commented Jun 6, 2017 at 9:03
  • @eryksun Yes, but this is related to windows 7 Commented Jun 6, 2017 at 9:13

1 Answer 1

1

Go to the control panel -> regional settings and check your date format. Date command is dependent on the registry/control panel settings.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.