Re: get date - 1 day

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Dr J R Stockton" <jrs@xxxxxxxxxxxxxxxxxx> wrote in message
news:Wa17TNWqfqaHFw08@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
In microsoft.public.scripting.vbscript message <OA7VMGpQIHA.1188@TK2MSFT
NGP04.phx.gbl>, Wed, 19 Dec 2007 23:50:25, "Pegasus (MVP)"
<I.can@xxxxxxx> posted:
"Hassan" <hassan@xxxxxxxx> wrote in message
news:emUaGwoQIHA.280@xxxxxxxxxxxxxxxxxxxxxxx
How can i get the value of the date i.e. one day minus todays date

Doing date arithmetic in a batch file is cumbersome
because you have to write your own routines to
calculate the number of days since an artifical start
date, e.g. 1 January 1970.

That's not quite true. Read alt.msdos.batch.nt to find how it has
already been done; or ask there. Also, stepping Y M D back one day at a
time, or N days, is not unduly difficult.


I am fully aware of the methods and I have tried them myself.
They involve formulae like these to calculate Julian dates:

if %m% LSS 3 set /a m=%m%+12 & set /a y=%y%-1
set /a z=-719560+ %d% + (153 * %m%-2) / 5 + 365 * %y% + %y% / 4 - %y% / 100
+ y / 400

In my book this is a little more involved than writing

DateAdd("d", -1, Date())


.



Relevant Pages

  • Re: when to use C and when to use C++
    ... happier writing this in C, simply because I know C so much better, so I'd ... I'll have to write some routines to do *the other*, ... It's only my *second* favourite language. ...
    (comp.lang.c)
  • Re: Autoexec to keep running
    ... classic mistake of writing all the routines THEN deciding what the ... Writing application event procedures ... I have a number of routines in modules that I want to run when the ... want is to fire when I open TEST.DOC ...
    (microsoft.public.word.vba.general)
  • Re: [Help] Struts/JSP -- easy way associate an "ID" to a "Value"?
    ... >> get around to writing my find routines? ... > then use after confirmation? ... Can I easily search by the key to get the value with a Map? ...
    (comp.lang.java)
  • Restoring to a New computer?
    ... I am writing this on the world's most reliable P III, a machine I am loathe ... routines may go bananas if I attempt to restore the PIII backup onto a brand ...
    (microsoft.public.windowsxp.general)
  • DLL in VB
    ... libraries as routines, and wish to compile them into a DLL and distribute it ... the DLL to work both with VB and C++. ... 4- If I am writing a routine that accepts an array as its argument, ...
    (microsoft.public.vb.general.discussion)