Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    use Time::Piece;
    ...
    my $t2 = localtime;
    print "Time is $t2\n";
    print "Year is ", $t2->year, "\n";
    
  2. or download this
    Time is Tue Dec 13 22:57:39 2005
    Year is 2005
    
  3. or download this
    $t->year                # based at 0 (year 0 AD is, of course 1 BC)
    $t->_year               # year minus 1900