🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.borland
Article #145

Re: Date calculations in TP55

#145
From: Patrick Dunford
Date: Sun, 09 Dec 2001 00:01
54 lines
3920 bytes
In article <KrmO2zEj2jE8Ewan@merlyn.demon.co.uk> in newsgroup 
borland.public.turbopascal on Sat, 8 Dec 2001 16:19:47 +0000, Dr John 
Stockton(spam@merlyn.demon.co.uk) said...
> JRS:  In article <MPG.167c96e9eb6c9e9e989910@news.clear.net.nz>, seen in
> news:comp.lang.pascal.borland, Patrick Dunford <a47xxy@yahoo.co.nz>
> wrote at Sat, 8 Dec 2001 08:30:03 :-
> >
> >I want to compare the date from a file (got with GetFTime) with today's 
> >date and get the difference in days.
> 
> Before posting to a newsgroup, it is wise to read recent articles in it.
> Most of your question has been answered in this newsgroup within the
> last 7 days, in a thread "Subject: FREE inline date-math subr - only TWO
> LINES long. Wow!".  Read the whole thread, though.

This thread does not appear in my newsreader; the server has expired it.

> Evidently you can get the file date with GetFTime and UnpackTime; and
> today with GetDate; you only need to be able to convert to a daycount,
> and you know that the range 1980-2099 is all that need be handled.  The
> 100- and 400- year rules can therefore be omitted.
> 
> My <URL: http://www.merlyn.demon.co.uk/programs/dateprox.pas>, needs
> <URL: http://www.merlyn.demon.co.uk/programs/version.pas>, tested with
> <URL: http://www.merlyn.demon.co.uk/programs/mjd_date.pas>, has numerous
> routines, including YMDtoMJD.
> 
> The following more limited method does not halt within 1900-03-01 to
> 2100-02-28, showing that in that range DV is calculated correctly.
> 
> uses dateprox ;
> 
> const ar : array [1..12] of integer
>   = (2,33,61,92,122,153,183,214,245,275,306,336) ;
> 
> var DV, MJD : MJDate ; Y : integer ; M, D : byte ;
> 
> BEGIN ;
> Writeln ;
> for MJD := YMDtoMJD(1900, 02, 26) to YMDtoMJD(2100, 03, 03) do begin
>   MJDtoYMD(MJD, Y, M, D) ;
>   DV := (longint(y-1900)*1461) div 4 + ar[M] + D ;
>   if (M<3) and (Y mod 4 = 0) then Dec(DV) ;
>   DV := DV + 23783 -6*1461 ;
>   Write(^M, MJD:10, DV:10, Y:10, M:3, D:3) ;
>   if MJD<>DV then Readln ;
>   end;
> END.
> 
> The core of that is much the same as in YMD2MJD1 and JPC_MJD of
> dateprox.pas.  N.B. dateprox is for TP7/BP7; but conversion to TP5.5
> should not be difficult.

Thanks.
Technical Details
Message-ID: <MPG.167d7121d4f362df989918@news.clear.net.nz>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-xfer.siscom.net!nntp2.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!news.clear.net.nz
References: <MPG.167c96e9eb6c9e9e989910@news.clear.net.nz> <KrmO2zEj2jE8Ewan@merlyn.demon.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 108ebd,f55e76139518d000
X-Google-Attributes: gid108ebd,public
X-Google-Thread: 111659,f55e76139518d000
X-Google-Attributes: gid111659,public
X-Google-ArrivalTime: 2001-12-08 16:01:30 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-xfer.siscom.net!nntp2.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!news.clear.net.nz
From: Patrick Dunford <a47xxy@yahoo.co.nz>
Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal
Subject: Re: Date calculations in TP55
Message-ID: <MPG.167d7121d4f362df989918@news.clear.net.nz>
References: <MPG.167c96e9eb6c9e9e989910@news.clear.net.nz> <KrmO2zEj2jE8Ewan@merlyn.demon.co.uk>
X-Newsreader: MicroPlanet Gravity v2.50
X-Y-Z: End of the alphabet
X-Original-NNTP-Posting-Host: 203-167-132-79.dialup.clear.net.nz
X-Original-Trace: 9 Dec 2001 13:01:09 +1300, 203-167-132-79.dialup.clear.net.nz
Organization: CLEAR Net New Zealand http://www.clear.net.nz - Complaints abuse@clear.net.nz
Lines: 54
NNTP-Posting-Date: Sat, 08 Dec 2001 18:01:12 CST
X-Trace: sv3-FTuK8zjzje+VPdN5uoYs6RKAGrCgte02YZIw/Q415dhQJSi2nnsWxcdNmAWZ7rB/5vDxaMsdXSdnvlo!ox4megu9pdmcT9Rp/VbB7bPYNoPHX9rltuk5mFAS+AGQ0m0AFPgg2A2najqBMYbRufmzaaZ94Fio!3iucgrnE
X-Complaints-To: abuse@GigaNews.Com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
Date: Sun, 09 Dec 2001 00:01:12 GMT