If you don't mind using a little VBScript you can use something like this:
' http://classicasp.aspfaq.com/date-time-routines-manipulation/can-i-make-vbscript-format-dates-for-me.html
' Use MSSTDFMT to mimic VB's Format() function. Provides more flexibility in
' formatting dates than the VBScript FormatDateTime() function.
On Error Resume Next
dim fmt
dim rs
set fmt = WScript.CreateObject("MSSTDFMT.StdDataFormat")
set rs = WScript.CreateObject("ADODB.Recordset")
rs.Fields.Append "fldExpression", 12 ' adVariant
rs.Open
rs.AddNew
fmt.Format = WScript.Arguments(0)
rs("fldExpression").DataFormat = fmt
rs("fldExpression").Value = Now()
WScript.Echo rs("fldExpression").Value
rs.close
set fmt = nothing
set rs = nothing
WScript.Quit(0)
I put this in a file called formatDate.vbs. You can then call from the command line, passing in the format you want:
C:>cscript //nologo formatDate.vbs "mm-dd-yyyy"
04-02-2009
C:>cscript //nologo formatDate.vbs "dd-mm-yyyy"
02-04-2009
C:>cscript //nologo formatDate.vbs "dd-MMM-yy"
02-Apr-09
C:>cscript //nologo formatDate.vbs "mm/dd/yyyy hh:mm"
04/02/2009 10:10
C:>cscript //nologo formatDate.vbs "dddddd ttttt"
Friday, April 03, 2009 6:48:57 AM
C:>cscript //nologo formatDate.vbs "General Date"
4/3/2009 6:49:53 AM
See Predefined Date/Time Formats and User-Defined Date/Time Formats in the MSDN for a complete list of formats you can use.
NOTE:
The MSSTDFMT object depends on the availability of MSSTDFMT.dll, which is installed by Visual Studio 6.0.
The MSSTDFMT.dll appears to be available on Windows XP and Windows 2003 servers; I checked a few machines that have never had MS Visual Studio installed and the DLL was present.