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%%d ate:~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..
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%%d
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..
The date format may change based on regional settings, but I would expect it to be the same on every machine otherwise.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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^
ASKER
vvk/paulmacd,
so what should i do to get MMDDYYYY format of current date in DOS ?
thanks
so what should i do to get MMDDYYYY format of current date in DOS ?
thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Will the date format change say if we move from windows server 2003 to windows server 2008? my machine is in US...
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
but it did not work .... it gave date value - %mm%%dd%%yyyy% and not 10062011
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
ASKER
thanks a lot that solved my problem...