Code Comments
Programming Forum and web based access to our favorite programming groups.Dear Friends,
I'd like to know what date 'Day 1' in Clipper usage is:
That is,
Today is (for me) Nov 19, 2004
If I perform the following simple calculation:
nDays := DATE() - CTOD("")
I get nDays equal to 2,453,329 (quite a while ago !!)
Question: What is *that* date a couple of a million days ago ??
Reason: I've got a user who is suggesting I use Julian Dates (and its day 0
),
but I think I'd prefer to use Clipper's Base Date.
TIA,
-Mel Smith
Post Follow-up to this messageOn 20 Nov 2004 01:53:32 GMT, medsyntel@aol.comnocrud (Mel Smith)
wrote:
>Dear Friends,
>
> I'd like to know what date 'Day 1' in Clipper usage is:
>
> That is,
>
> Today is (for me) Nov 19, 2004
>
> If I perform the following simple calculation:
>
> nDays := DATE() - CTOD("")
>
> I get nDays equal to 2,453,329 (quite a while ago !!)
>
>Question: What is *that* date a couple of a million days ago ??
>
>Reason: I've got a user who is suggesting I use Julian Dates (and its day
0),
>but I think I'd prefer to use Clipper's Base Date.
>
>TIA,
>
>-Mel Smith
>
>
Hi Mel,
How about doing
dDate := Date() - 2453329
Alert( "day 1 is " + dtoc( dDate ) )
I use Julian date/time for some applications, eg countdown timer for
future events like weddings, or for calculating high resolution ages.
But I use a nominal base year of 2000 (used to be 1990) for future
events and 1900 for past ones.
I have Phil Barnett's collection of julian date functions (on the
Oasis as JULIAN.ZIP) which I have modified for my own use. Happy to
send to you if you want.
Regards,
Ross McKenzie
ValuSoft
Melbourne Australia
valusoft AT optushome DOT com DOT au
When there's a will, I want to be in it
Post Follow-up to this messageOn Sat, 20 Nov 2004 05:40:12 +0000, Ross McKenzie sez: > Alert( "day 1 is " + dtoc( dDate ) ) Ross, did you try that and get an actual date as a result? I assume that "alert" thing is some xharbour gizmo, but in plain ol' Clipper that gets you a null date. In fact, I discovered that Clipper doesn't do B.C. at all - any date before 01/01/0001 comes back as 0/0/0. Just roughly calculating it (at 365.25 days per year) gets about 6700 B.C. -- Peter B. Steiger Cheyenne, WY If you must reply by email, you can reach me by placing zeroes where you see stars: wypbs_**3 at bornagain.com.
Post Follow-up to this messageIn article <419ed697.23743812@news> valusoft "Ross McKenzie" writes: > On 20 Nov 2004 01:53:32 GMT, medsyntel@aol.comnocrud (Mel Smith) > wrote: > As far as I can tell, somewhen around 4713 BC though I have no idea what significance it might have! Some time back when I was trying to fix a "feature" in the S87 leap year handling I came across a magic number, 1721060, in the library code and which is used as a bias for BC dates and wondered then why such a number had been chosen. If you do the rough maths, (2453329 - 1721060) / 365.25 comes out around 2004.8 which is pretty close to today's date (in years). So "DATE() - 1721060" should give you the number of days since 01/01/0000 (or perhaps 01/01/0001 as there was no year 0). And as far as I can see the S87 code takes no account of the "lost" days at the changeover of the Julian/Gregorian calendars. If you're interested in this stuff there's almost certainly a blow-by-blow account at <http://www.merlyn.deon.co.uk> (I haven't checked). > > Hi Mel, > > How about doing > > dDate := Date() - 2453329 > > Alert( "day 1 is " + dtoc( dDate ) ) I haven't tried that, but would not be surprised to see 00/00/00 or a runtime error... > I use Julian date/time for some applications, eg countdown timer for > future events like weddings, or for calculating high resolution ages. > But I use a nominal base year of 2000 (used to be 1990) for future > events and 1900 for past ones. > > I have Phil Barnett's collection of julian date functions (on the > Oasis as JULIAN.ZIP) which I have modified for my own use. Happy to > send to you if you want. > > Regards, > > Ross McKenzie > ValuSoft > Melbourne Australia > > valusoft AT optushome DOT com DOT au > > When there's a will, I want to be in it Presumably as a beneficiary rather than as the late departed? <g> Pete -- "We have not inherited the earth from our ancestors, we have borrowed it from our descendants."
Post Follow-up to this messageOn Fri, 19 Nov 2004 23:52:06 -0700, "Peter B. Steiger" <see.sig@for.email.address> wrote: >On Sat, 20 Nov 2004 05:40:12 +0000, Ross McKenzie sez: > >Ross, did you try that and get an actual date as a result? What...and have to go into debugging mode as a result? No. >I assume that >"alert" thing is some xharbour gizmo, "Alert", an xharbour gizmo ?. No, introduced with Clipper 5.01 <g>. >but in plain ol' Clipper that gets >you a null date. In fact, I discovered that Clipper doesn't do B.C. at all >- any date before 01/01/0001 comes back as 0/0/0. See below... > >Just roughly calculating it (at 365.25 days per year) gets about 6700 B.C. > >-- >Peter B. Steiger >Cheyenne, WY >If you must reply by email, you can reach me by placing zeroes >where you see stars: wypbs_**3 at bornagain.com. > PS...went into debugging mode anyway <g>. On 20 November 2004 subtract 732 270 days you get back to New Year's Day of the 1st century (01/01/0000). Subtract any larger numbers and you get a constant 00/00/0000. All dates between 01/01/0000 and your bottom limit Peter are actually accessible, so I am assuming a typo on your part. Now wasn't that fun? Speaking of which...in the early 1980s I lived/worked in Saudi Arabia. Their calendar is named Hijra (hope that is the correct transliteration) and the year was something like 1471 at the time. One day we calculated how long it would take the year of the Hijra calendar to be numerically equivalent numerically to the Gregorian calendar. It was another 25,000 years or thereabouts as I recall it. Always thought that we should metricate dates...10 hours to the day, 10 days to the w, 10 w
s to the month, etc, etc, enough nonsense...see what you started Mel!!! Regards, Ross McKenzie ValuSoft Melbourne Australia valusoft AT optushome DOT com DOT au When there's a will, I want to be in it
Post Follow-up to this messageOn Sat, 20 Nov 2004 07:49:04 +0000 (UTC), pete@nospam.demon.co.uk wrote: >In article <419ed697.23743812@news> valusoft "Ross McKenzie" writes: > > >As far as I can tell, somewhen around 4713 BC though I have no >idea what significance it might have! Some time back when I was >trying to fix a "feature" in the S87 leap year handling I came >across a magic number, 1721060, in the library code and which is >used as a bias for BC dates and wondered then why such a number >had been chosen. 1721060 is the number of copies of Clipper NEVER bought, but in use at any date... > >If you do the rough maths, (2453329 - 1721060) / 365.25 comes out >around 2004.8 which is pretty close to today's date (in years). >So "DATE() - 1721060" should give you the number of days since >01/01/0000 (or perhaps 01/01/0001 as there was no year 0). And as >far as I can see the S87 code takes no account of the "lost" days >at the changeover of the Julian/Gregorian calendars. If you're >interested in this stuff there's almost certainly a blow-by-blow >account at <http://www.merlyn.deon.co.uk> (I haven't checked). > > >I haven't tried that, but would not be surprised to see 00/00/00 >or a runtime error... No GPF....a null string though. > >Presumably as a beneficiary rather than as the late departed? <g> Preferably <g> > >Pete >-- > "We have not inherited the earth from our ancestors, > we have borrowed it from our descendants." Regards, Ross McKenzie ValuSoft Melbourne Australia valusoft AT optushome DOT com DOT au When there's a will, I want to be in it
Post Follow-up to this messageOn Sat, 20 Nov 2004 07:49:04 +0000 (UTC), pete@nospam.demon.co.uk wrote: >If you're >interested in this stuff there's almost certainly a blow-by-blow >account at <http://www.merlyn.deon.co.uk> (I haven't checked). > Slight typo, Pete: http://www.merlyn.demon.co.uk/
Post Follow-up to this messageIn article <h16up01d8olaeh64ih4111f7n6gag0tggj@4ax.com> delete-all-spam2@witzendcs.co.uk "Nick Ramsay" writes: > On Sat, 20 Nov 2004 07:49:04 +0000 (UTC), pete@nospam.demon.co.uk > wrote: > > Slight typo, Pete: > > http://www.merlyn.demon.co.uk/ Oops! That'll teach me not to post so early, before the caffeine has had a chance to get the brain and fingers working properly <g> Thanks for the correction, Nick. Pete -- "We have not inherited the earth from our ancestors, we have borrowed it from our descendants."
Post Follow-up to this messageDear Friends, I wrote a little looping proggy that takes me back to Day '0'. Turns out that the BaseDate of Clipper 5.2e is (by my calcs) is: Wednesday, Feb 8, 4712 BC Now why is it not a Sunday (or a Saturday ??)
Post Follow-up to this messageDear Friends, A 'typo' in my previous post. Clipper BaseDate is *Thursday*, Feb 8, 4712 BC
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.