Date Format

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

Is there a way to change the date format from 10/20/04 to Oct. 20, 2004 in
command line without using any utility.

thanks in advance
 
Is there a way to change the date format from 10/20/04 to Oct. 20,
2004 in command line without using any utility.
It's unclear if you want to permanently change the current users date
format or just output the current date in that format.

Does any utility mean external or really any.

For a start have a look at :
set /?
 
Mikhail said:
thanks Matthias. No just output the current date in that format.
Hi

A combined batch/vbs solution:


--------------------8<----------------------

@echo off
echo D = Now : MN = MonthName(Month(D), True) >%temp%\today.vbs
echo WScript.Echo MN ^& ". " ^& Day(D) ^& ", " ^& Year(D) >>%temp%\today.vbs

for /f "tokens=*" %%a in (
'cscript.exe //Nologo %temp%\today.vbs') do set today=%%a

del %temp%\today.vbs
echo Todays date: %today%

--------------------8<----------------------
 
It's unclear if you want to permanently change the current users date
format or just output the current date in that format.

Does any utility mean external or really any.

For a start have a look at :
set /?

To output the current date at MMM. DD, YYYY on any NT-based O/S, using English:

set montab=XXX.Jan.Feb.Mar.Apr.May Jun.Jul.Aug.Sep.Oct.Nov.Dec.
set $tok=1-3
for /f "tokens=1 delims=.:/-, " %%u in ('date /t') do set $d1=%%u
if "%$d1:~0,1%" GTR "9" set $tok=2-4
for /f "tokens=%$tok% delims=.:/-, " %%u in ('date /t') do (
for /f "skip=1 tokens=2-4 delims=/-,()." %%x in ('echo.^|date') do (
set %%x=%%u
set %%y=%%v
set %%z=%%w
set $d1=
set $tok=))
set /a mm=(100%mm%%%100) * 4
call set month=%%montab:~%mm%^,4%%
@echo %month% %dd%, %yy%


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
thanks all. Both works perfectly..

Jerold Schulman said:
To output the current date at MMM. DD, YYYY on any NT-based O/S, using English:

set montab=XXX.Jan.Feb.Mar.Apr.May Jun.Jul.Aug.Sep.Oct.Nov.Dec.
set $tok=1-3
for /f "tokens=1 delims=.:/-, " %%u in ('date /t') do set $d1=%%u
if "%$d1:~0,1%" GTR "9" set $tok=2-4
for /f "tokens=%$tok% delims=.:/-, " %%u in ('date /t') do (
for /f "skip=1 tokens=2-4 delims=/-,()." %%x in ('echo.^|date') do (
set %%x=%%u
set %%y=%%v
set %%z=%%w
set $d1=
set $tok=))
set /a mm=(100%mm%%%100) * 4
call set month=%%montab:~%mm%^,4%%
@echo %month% %dd%, %yy%


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Back
Top