develooper Front page | perl.datetime | Postings from January 2003

Re: Picking up the ball

Thread Previous | Thread Next
January 12, 2003 22:54
Re: Picking up the ball
Message ID:
About the long debate of 1..12 veersus 0..11

Did you read RFC-48 for Perl 6? In this RFC, Nathan Wiger suggest
that every day-related interval be 1-based, especially the month would
be 1..12.

Another good point is to drop this silly 1900 offset for year, so we
would currently be in 2003, not in 103 or 19103 or whatever.

The RFC has not been yet accepted by Larry, but I trust he will 
accept it.

Another is that it is easier to interpolate with a 1..12 value than
with a 0..11 value. Let us take, for example, 13 January 2003.
Compare the following pieces of code:

  my @months = qw(Jan Feb Mar ...);
  my ($y, $m, $d) = (2003, 1, 13);
  print "Today is $y-$m-$d\n";
  print "Today is $d $months[$m - 1] $y\n";

  my @months = qw(Jan Feb Mar ...);
  my ($y, $m, $d) = (2003, 0, 13);
  print "Today is $y-@{[$m+1]}-$d\n";
  print "Today is $d $months[$m] $y\n";

Which one is easier to read? Which one is easer to code?

For these reasons, I support the 1..12 values, as well as RFC-48.


Dave Rolsky once said:

> But days only have names in terms of their position in the week.  Unless
> you call today "Elevenday" or something ;)

Well, in the French Revolutionary calendar, this is almost the case.
In this calendar, all months are exactly 30 days long. The week are
replaced by décades (*), so the month limits are aligned with 
décade limits. The result is that days are more or less named 
in terms of their position in the month:
1, 11 and 21 are named Primedi (firstday),
2, 12 and 22 are named Duodi (twoday),
3, 13 and 23 are named Tridi (threeday),

(*) Not to be confused with the English decade. The French décade
is 10 days. The English decade is the French décennie, 10 years.

Dave Rolsky, about my French_Rev module:

> If it is renamed to DateTime::Calendar::FrenchRevolution, it'll have to
> deal with hhmmss.  It's that simple.

Well, it is not *that* simple. In addition to creating a new
calendar, Fabre d'Eglantine and Romme changed the duration of
the hour, minute and second, so each day would be split into
10 hours, each hour into 100 minutes and each minute into 100
seconds. Which unit should my module deal with? 
"Anglo-Babylonian" sexagesimal second or decimal second?


Jean Forget

WYGIWYGAINGW =  "What You Get Is What You're Given And It's 
No Good Whining."

     Archichancelier Mustrum Ridcully
     (cité par Terry Prachett dans The Science of Discworld)

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About