Newsgroups: comp.lang.perl.misc
From: PerlFAQ Server <br...@stonehenge.com>
Date: Sat, 10 May 2008 12:03:02 -0700
Local: Sat, May 10 2008 3:03 pm
Subject: FAQ 4.12 How do I find the day or week of the year?
This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 4.12: How do I find the day or week of the year? The localtime function returns the day of the year. Without an argument $day_of_year = (localtime)[7]; The "POSIX" module can also format a date as the day of the year or week use POSIX qw/strftime/; To get the day of year for any date, use "POSIX"'s "mktime" to get a use POSIX qw/mktime strftime/; The "Date::Calc" module provides two functions to calculate these. use Date::Calc; -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They If you'd like to help maintain the perlfaq, see the details in You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||