[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Re: dates



>you mean I have to make a subroutine to change 0 to 1?
>
>I knew about the 0 but it just didn't occur to me it would happen in the
>dates too.

Name of month and name of day of week are most easily obtained by indexing
into an array of strings.  Ergo, somebody (Larry?) decided that the combination

   print "$monthname[$monthindex] $daynumber, $year";
   ...
   printf "%02d/%02d/%02d", $monthindex+1, $daynumber, $yearnumber;

was less inconvenient (more likely?) than

   printf "%s %d, %d", "$monthname[$monthnumber-1], $daynumber, $year;
   ...
   printf "%02d/%02d/%02d", $monthnumber, $daynumber, $yearnumber;

(or any number of variations on (s)print(f)...)

P.S.  How many days from today is tomorrow?  1
      How many days from today is today?     0
      Stepping and counting both start at 0, since that is the least you can
      do/have.

"Zero is the most natural number."  E. W. Dijkstra

--------------------------------------------------------------------
-jn- (my two cats have accepted full responsibility for my opinions)
--------------------------------------------------------------------