0

I am generating the date in a format of YYYYMMDD so that i can append it in the filename that the batch program generates.

But in my local system echo %date% returns

echo %date%
Tue 09/08/2015

The date information is returned so i can modify it the way i want

In server, the same does not return date values

echo %date%
 /Tu

I dont have date values to modify it to my required format YYYYMMDD

How do I go about this? Is there any Windows date and time setting that i should be looking at?

Varun Rao
  • 781
  • 1
  • 10
  • 31
  • 1
    It probably depends on regional settings and possibly versions of Windows (on my UK-English XP and Win7 systems, both return `08/09/2015`). The second result looks odd though: check you haven't got an environment variable masking the value (run `set d` to see if `date` is listed). – TripeHound Sep 08 '15 at 12:29
  • 2
    This may help you: http://stackoverflow.com/questions/17184242/command-prompt-bat-file-create-new-folder-named-with-todays-date/17186963#17186963 – foxidrive Sep 08 '15 at 12:31
  • @TripeHound `Environment variable d not defined` is the Output of `set d` – Varun Rao Sep 08 '15 at 12:37
  • That means you haven't got an explicit `DATE` variable overriding the built-in `%DATE%` function. I'd probably follow the answer foxidrive linked to.as it eliminates regional variations. – TripeHound Sep 08 '15 at 12:51

1 Answers1

0

The date format depends on the regional settings of your machine. You can check them in control panel (run intl.cpl), they seem to be broken.

ths
  • 2,858
  • 1
  • 16
  • 21