Re: get date - 1 day



In microsoft.public.scripting.vbscript message <#YcHjzzQIHA.1204@TK2MSFT
NGP03.phx.gbl>, Thu, 20 Dec 2007 20:16:55, "Pegasus (MVP)"
<I.can@xxxxxxx> posted:

"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:

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())

Of course. But you put "write your own", which does not have the same
meaning as "copy someone else's".

Please note that VBScript cannot, unaided, determine true Julian Dates,
because they change, by definition, at noon GMT. It can determine
Chronological Julian Date, which changes at midnight local time. But
CJD is currently 2454456 and the above expression yields something much
smaller - about 13868 I think, so that's something like Chronological
Modified Julian Date or Chronological Truncated Julian date but with an
origin not normally used in the Outside World. Yes, today is indeed
Chronological UNIX 13868 - no valid connection with a Julius.


I presume you know that fly.com is owned by Flycor in Hawaii?

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
.



Relevant Pages

  • Re: (PLEASE: DESPERATED) Conversion from seconds to YYYY-MM-DD : HH-MM-SS
    ... Olathe writes: ... Julian date routines do this quite well. ... So date calculations are just converting dates to "Julian ...
    (comp.programming)
  • Re: ANN: Julian dates
    ... those who use Tcl/SQLite, but hopefully not limited to those, I've ... relatively portable C library of Julian ... date routines, and a Tcl binding for it under an open source license. ... 73 de ke9tv/2, Kevin ...
    (comp.lang.tcl)
  • Re: get date - 1 day
    ... because you have to write your own routines to ... stepping Y M D back one day at a ... They involve formulae like these to calculate Julian dates: ... In my book this is a little more involved than writing ...
    (microsoft.public.scripting.vbscript)
  • Re: Format Question
    ... I'm assuming that your "Julian date" is the XL sequential number for the ... rather than a true Julian date. ... > The problem that I encounter is Cell A1 is all text and Cell A2 is a ... Prev by Date: ...
    (microsoft.public.excel)
  • Gregorian to Julian Date conversion
    ... Is there a class that converts from Gregorian date to TRUE Julian Date in ... The Julian date is calculated by the number of days since January 1, ... Chris Davoli ...
    (microsoft.public.dotnet.framework.aspnet)