RE: OT: %date%

  • From: "josephk" <josephk@xxxxxxxxx>
  • To: "[ISAserver.org Discussion List]" <isalist@xxxxxxxxxxxxx>
  • Date: Wed, 7 Jul 2004 13:39:00 -0700

Hi Steve,
Are you using vbscript or javascript?

In vbscript:

Dim curMonth, curDay, curYear, curFullYear, curDisplayDate

curYear = Year(Date)   ' curDay would contain 07.
curMonth = Month(Date) ' curMonth would contain 07
curYear = DatePart("yy", Date)   ' curYear would contain 04.
curFullYear = DatePart("yyyyy", Date)   ' curYear would contain 04.
Or 
curFullYear = Year(Date)

curDisplayDate = curMonth & curDay & curYear

BATCH.CMD STUFF
ECHO OFF

REM METHOD 1

for /f "tokens=1,2,3,4* delims=/ " %%i in ('date /t') do set ^
indate=%%l%%j%%k

Set curFullYear=%indate:~0,4%
Set curYear=%indate:~2,2%
set curMonth=%indate:~4,2%
Set curDay=%indate:~6,2%

echo %curYear%
echo %curFullYear%
echo %curMonth%
echo %curDay%
echo %inDate%



REM METHOD 2

 FOR /f "tokens=2-4 skip=1 delims=(-)" %%G IN ('echo.^|date') DO (
      FOR /f "tokens=2 delims= " %%A IN ('date /t') DO (
         SET v_first=%%G
         SET v_second=%%H
         SET v_third=%%I
         SET v_all=%%A
      )
   )

      SET %v_first%=%v_all:~0,2%
      SET %v_second%=%v_all:~3,2%
      SET %v_third%=%v_all:~8,4%

   ECHO Today is Year: [%yy%] Month: [%mm%] Day: [%dd%]

   ENDLOCAL & SET v_year=%yy%& SET v_month=%mm%& SET v_day=%dd%


Thank you,

Joseph
-----Original Message-----
From: Stephen Herrera [mailto:sherrera@xxxxxxxxxx] 
Sent: Wednesday, July 07, 2004 11:36 AM
To: [ISAserver.org Discussion List]
Subject: [isalist] OT: %date%


http://www.ISAserver.org

Is there a way inside of a batch file that I can change the way that
%date% outputs? I would like it to do 070704 instead of Wed 07/07/04.

Steve

------------------------------------------------------
List Archives: http://www.webelists.com/cgi/lyris.pl?enter=isalist
ISA Server Newsletter: http://www.isaserver.org/pages/newsletter.asp
ISA Server FAQ: http://www.isaserver.org/pages/larticle.asp?type=FAQ
------------------------------------------------------
Other Internet Software Marketing Sites:
World of Windows Networking: http://www.windowsnetworking.com Leading
Network Software Directory: http://www.serverfiles.com No.1 Exchange
Server Resource Site: http://www.msexchange.org Windows Security
Resource Site: http://www.windowsecurity.com/ Network Security Library:
http://www.secinf.net/ Windows 2000/NT Fax Solutions:
http://www.ntfaxfaq.com
------------------------------------------------------
You are currently subscribed to this ISAserver.org Discussion List as:
josephk@xxxxxxxxxxxxxxxxx To unsubscribe visit
http://www.webelists.com/cgi/lyris.pl?enter=isalist


Other related posts: