Making a Calendar using Date::Calc

Top Japanese page




Overview

Display the following calendar using Date::Calc.

          May 2007
 Mon Tue Wed Thu Fri Sat Sun
       1   2   3   4   5   6
   7   8   9  10  11  12  13
  14  15  16  17  18  19  20
  21  22  23  24  25  26  27
  28  29  30  31

Flow

  1. Load Date::Calc
  2. Execute Calendar method

A sample code

 use Date::Calc qw(Calendar);
 
 print "Content-Type: text/plain\n\n";
 
 print Calendar(2007,5);

Description of the code

 use Date::Calc qw(Calendar);

Load Date::Calc.

 print "Content-Type: text/plain\n\n";

Display an header. In this case, the output is plain text. You can also do <pre></pre> with outputing text/html.

 print Calendar(2007,5);

Execute the Calendar method. In this example, May 2007 is displayed.