Find the day or week of the year - Perl

day or week of year

Snippet Code


  
Rate this page :
  [ 0 votes]

#!/usr/bin/perl print "content-type:text/htmlnn"; use POSIX qw/strftime/; my $day_of_year = strftime "%j", localtime; my $week_of_year = strftime "%W", localtime; print "Day of year : ".$day_of_year."nWeek of year : ".$week_of_year; # Use the below code if you have Date::Calc module installed # use Date::Calc; # my $day_of_year = Day_of_Year( 1987, 12, 18 ); # my $week_of_year = Week_of_Year( 1987, 12, 18 );

Tags


Ask Questions

Ask Question