On 30 Oct 2012 at 12:23, Oliver Marshall wrote: > Hi > > Not the right list I know but I thought you might be able to help. > > I have the date in the format of yyyy.mm.dd. I need to format that to > ddmmyyyy within a batch file. > > Does anyone know how to do that or know of a small commad line app that > can let me do that?
FWIW here's my date-string batch-file ======================================== @ECHO OFF set dDate=%date% set dTime=%time% set month=%dDate:~4,2% if .%month%==.01 set MMM=Jan if .%month%==.02 set MMM=Feb if .%month%==.03 set MMM=Mar if .%month%==.04 set MMM=Apr if .%month%==.05 set MMM=May if .%month%==.06 set MMM=Jun if .%month%==.07 set MMM=Jul if .%month%==.08 set MMM=Aug if .%month%==.09 set MMM=Sep if .%month%==.10 set MMM=Oct if .%month%==.11 set MMM=Nov if .%month%==.12 set MMM=Dec set year=%dDate:~-4% set yy=%dDate:~-2% set day=%dDate:~7,2% set d1=%dDate:~7,1% set d2=%dDate:~8,1% if not .0==.%d1% set /a week=%day%/7 + 1 if .0==.%d1% set /a week=%d2%/7 + 1 set mdy=%month%/%day%/%year% set cymd=%year%%month%%day% set ymd=%yy%%month%%day% set y-md=%year%-%month%-%day% set dow=%dDate:~0,3% set hour=%dTime:~0,2% set h1=%dTime:~0,1% if .==.%h1% set hour=%dTime:~1,1% if .==.%h1% set hour=0%hour% set h1= set min=%dTime:~3,2% set sec=%dTime:~6,2% set sech=%dTime:~-5% if .%1==. goto done if not .%1==.SHOW if not .%1==.show goto done echo date=%dDate% echo mdy=%mdy% echo cymd=%cymd% echo ymd=%ymd% echo y-md=%y-md% echo day=%day% month=%month% year=%year% yy=%yy% echo MMM=%MMM% week=%week% dow=%dow% echo time=%dTime% hour=%hour% min=%min% sec=%sec% sech=%sech% :Done ======================================== Save as GETDATE.CMD, run with "show" as a parameter to display what it sets. Works on Windows from XP on. Angus -- Angus Scott-Fleming GeoApps, Tucson, Arizona 1-520-290-5038 Security Blog: http://geoapps.com/ ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to listmana...@lyris.sunbeltsoftware.com with the body: unsubscribe ntsysadmin