If you don't enter an argument, it will take the current system date of your computer and change it from 'Sat 12/06/2008' and change it to 2008-12-06.

Assuming date /t on your computer gives you Sat 12/06/2008

cscript /nologo datediff.vbs 1 would show you 2008-12-05
cscript /nologo datediff.vbs 2 would show you 2008-12-04
cscript /nologo datediff.vbs 31 would show you 2008-11-05

PHP Code:
' returns the date for how many days back you need to find the date for in YYYY-MM-DD format.

Option Explicit

Dim strNum, arrDate, strYear, strMonth, strDay, strDate
Dim objArgs

Set objArgs = WScript.Arguments

if WScript.Arguments.Count < 1 then 
    strNum = "0"
Else
    strNum = Wscript.Arguments(0)
End If

arrDate = Split(DateAdd( "d" , -strNum , Date ), "/", -1, 1 )
strYear = arrDate(2)
strMonth = arrDate(0)
strDay = arrDate(1)
if strMonth < 10 then strMonth = "0"&strMonth
if strDay < 10 then strDay = "0"&strDay
strDate = strYear & "-" & strMonth & "-" & strDay

wscript.echo strDate 
To use it in a DOS/CMD batchfile
for /f "tokens=*" %%a in ('cscript /nologo datediff.vbs 0') do set MyNewDate=%%a

echo %MyNewDate%
2008-12-06

WHY IS THE BB CODE tag broken ??????????
HA! PHP code isn't broke