Link to home
Start Free TrialLog in
Avatar of at999
at999

asked on

MS-DOS Date format on different computers

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..
 
Avatar of Paul MacDonald
Paul MacDonald
Flag of United States of America image

The date format may change based on regional settings, but I would expect it to be the same on every machine otherwise.
SOLUTION
Avatar of vvk
vvk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In the Solution for your web site you should be able to right-click on the project and Add Service Reference.  This should give you access to the events exposed by the service.
Sorry...ignore that^
Avatar of at999
at999

ASKER

vvk/paulmacd,
so what should i do to get MMDDYYYY format of current date in DOS ?

thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of at999

ASKER

Will the date format change say if we move from windows server 2003 to windows server 2008? my machine is in US...
Avatar of at999

ASKER

also, i tried the sample in that link -  http://www.tech-recipes.com/rx/956/windows-batch-file-bat-to-get-current-date-in-mmddyyyy-format/

but it did not work .... it gave date value - %mm%%dd%%yyyy% and not  10062011
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of at999

ASKER

how do I call VBS in an MS-DOS batch file? and get that date? thanks a lot
I've showed you that - my code snippet uses that technique. It echoes commands to a .VBS file, runs that file with cscript (the console version of Windows Scripting Host), and processes the output. The .VBS file is then deleted.
Avatar of at999

ASKER

thanks a lot that solved my problem...