[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


MS - DOS Date variable format

Posted on 2011-10-05
Medium Priority
Last Modified: 2012-05-12
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..
Question by:at999
  • 3
LVL 37

Expert Comment

by:Jian An Lim
ID: 36923167
good question
this settings is dependent on OS language of the computer.

LVL 37

Expert Comment

by:Jian An Lim
ID: 36923173
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 :)

Author Comment

ID: 36926413

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
LVL 37

Accepted Solution

Jian An Lim earned 2000 total points
ID: 36927486
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.

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Remote Apps is a feature in server 2008 which allows users to run applications off Remote Desktop Servers without having to log into them to run the applications.  The user can either have a desktop shortcut installed or go through the web portal to…
Know what services you can and cannot, should and should not combine on your server.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question