× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Can I get the Day of the week?
  • From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Wed, 16 May 01 22:45:11 +1000

S
Hello  Peter,

You wrote:
>Just for fun, how about using a BIF? I have no idea if it's faster; then
>again with today's processors, speed is not always a big issue. But it's
>shorter. And by using 0001-01-01 as the base, I don't have to worry about
>negatives. However, it does return Monday as 1 instead of the more
>traditional Sunday, and I have no idea if it's correcting for dates prior to
>1533 or whenever it was that the calendar was adjusted...

The system uses a Proleptic Gregorian calendar for its date calculations.  That 
means it applies Gregorian rules to dates that are really Julian.  It doesn't 
compensate for the rules that were in force prior to 4th October 1582 (when 
the Gregorian calendar came in force -- at least in most Catholic countries) or 
prior to 2nd September 1752 for Britain or its colonies (including the USA at 
the time).

The system uses the Scaliger algorithm to calculate dates which in itself has 
an 
interesting bug.  Initialise a DATE field in RPG IV to 0300-03-01 and use debug 
to see what date actually gets stored.

Sunday is the conventional start of the week in Western countries, but the ISO 
standard pegs the start of the week as Monday.  And 0001-01-01 was actually a 
Sunday and 9999-12-31 will be a Friday (assumming there is no compensation for 
the leap year drift that will be apparent by 4000).

Watch this space for a set of date routines that does handle historical dates 
correctly ....

P.S. %REM (and its litter mate %DIV) came in at 440 for those of you 
contemplating using it.

Regards,
Simon Coulter.

«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
«» FlyByNight Software         AS/400 Technical Specialists       «»
«» Eclipse the competition - run your business on an IBM AS/400.  «»
«»                                                                «»
«» Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\   «»
«» Fax:   +61 3 9419 0175   mailto: shc@flybynight.com.au   \ /   «»
«»                                                           X    «»
«»               ASCII Ribbon campaign against HTML E-Mail  / \   «»
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.