MS - DOS Date variable format

When i do this on my computer
echo %date%
it shows
Wed 10/05/2011

I am trying to extract month/date/year from that date

Now, i am tryign to run batch program and I want to extract date in form of MMDDYYYY from that date value.

So I do this -
set DATALOADDATE=%date:~4,2%%date:~7,2%%date:~10,4%

My question is will the format of date change on other machine, is the date format - Wed 10/05/2011 dependent on the Operating system or the way user has set to? Or it will be like this on all the machines?

thanks a lot..
Who is Participating?
Jian An LimSolutions ArchitectCommented:
i am not sure about US-english and French, but my understand at least the korean, chinese will be very different because the FRI will be done local language, and US-english might done the date is MM.DD.YYYY

again. i would recommend you to run this over a few different OS language to confirm the settings.
Jian An LimSolutions ArchitectCommented:
good question
this settings is dependent on OS language of the computer.
Jian An LimSolutions ArchitectCommented:
I have use the method you wrote and havent come across anything yet. but again, it is not bullet proof :)

depends whether you need to complicate your code, or just use yours :)
at999Author Commented:

thanks for the info,

"this settings is dependent on OS language of the computer "  does it mean its different for US-English, French etc,... thanks
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.