DelphiFAQ Home Search:
General :: Programming :: perl
General questions about perl.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Recommended links on this topic:
Featured Article

Determine the day of the year

Question:

How can I find out what day of the year it is?

Answer:

Use localtime() and either simply access element [7]:

my $day_of_year = (localtime(time()))[7];
 
 #------------------
 # better to read:
 
 use Time::localtime;
 
 my $day_of_year = localtime(time())->yday;  
 

Generated 0:02:25 on Nov 25, 2017