Re: Working with dates ...
- From: Jerold Schulman <Jerry@xxxxxxxxxx>
- Date: Thu, 01 Feb 2007 09:28:44 -0500
On Thu, 1 Feb 2007 05:14:01 -0800, Cameron Young <CameronYoung@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Script type ... NT batch scripting.
OS's ... Win2K, Win2K3
Am using the following script code to get the current date...
for /F "tokens=1-4 delims=/ " %%i in ('date /t') do (
set DayOfWeek=%%i
set Day=%%j
set Month=%%k
set Year=%%l
set Date=%%l-%%k-%%j
)
I'd like to be able to acquire the previous day's date, but not sure how I
can accomplish this in a batch script environment.
Can anyone assist in my query?
- - - - - - - - - - - - - - - - - - -
Cheers,
Cameron
The above script doesn't work on W2K3 because the date /t command doesn't return the day name.
To get todays date, regardless of NT version:
Call UnivDate
See tip 4835 » The Universal Date Parser, modified to also work with Windows XP.
in the 'Tips & Tricks' at http://www.jsifaq.com
see tip 8181 » How can I insure that a year, month, and day contain 4,2, and 2 digits, respectively?
See tip 8293 » How can I return the date that is plus or minus n days from today?
Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
.
- Follow-Ups:
- Re: Working with dates ...
- From: Cameron Young
- Re: Working with dates ...
- Prev by Date: Re: ActiveX error
- Next by Date: Re: Working with dates ...
- Previous by thread: Re: ActiveX error
- Next by thread: Re: Working with dates ...
- Index(es):
Relevant Pages
|