2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by mitchems
0

I like to use Date::Manip, but it is rather large.

http://search.cpan.org/~sbeck/Date-Manip-6.11/lib/Date/Manip.pod

You can do a TON of stuff with this module. Run the pod to text to get the full help text with formats, date calculations, etc.

use Date::Manip;
$ENV{TZ}="EST";
use strict;
use warnings;
my $ptoday=ParseDate("today");
my $ftoday=UnixDate($ptoday,"%m/%d/%Y");
print "$ftoday\n";
my $month=UnixDate($ptoday,"%m");
my $day=UnixDate($ptoday,"%d");
my $year=UnixDate($ptoday,"%Y");

my $dayofyear=Date_DayOfYear($month,$day,$year);
print "$dayofyear\n";
0

Here's a little additional code for what you want...

use Date::Manip;
$ENV{TZ}="EST";
use strict;
use warnings;
my $ptoday=ParseDate("today");
my $ftoday=UnixDate($ptoday,"%m/%d/%Y");
print "$ftoday\n";
my $month=UnixDate($ptoday,"%m");
my $day=UnixDate($ptoday,"%d");
my $year=UnixDate($ptoday,"%Y");

my $dayofyear=Date_DayOfYear($month,$day,$year);
print "$dayofyear\n";

my $ndate=ParseDate("this $dayofyear day of this year");
my $fdate=UnixDate($ptoday,"%m/%d");
print "$fdate\n";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.