MS - DOS Date variable format

Posted on 2011-10-05
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
    LVL 35

    Expert Comment

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

    Expert Comment

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


    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 35

    Accepted Solution

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    1. Boot PC and press F10, select storage options and change the compatibility from “AHCI” to “IDE”, save and exit 2. Boot PC and press F12 3. Upon PXE display of searching for DHCP server, press Pause break to obtain MAC address 3. Open Configu…
    My previous article  ( one possible method to get SCCM 2007 installed an…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now