How do i find day-of-the-year for specific date... Something like localtime(time) but this one for current date, what i want is for specific date like what is the day-of-the-year for Feb 2 1999?? Please help me with this one...
Apr 11, 1999, 1:07 PM
Administrator (9387 posts)
Apr 11, 1999, 1:07 PM
Post #2 of 2
Views: 2875
Hmm, you could do:
my $time = timelocal ($sec, $min, $hour, $day, $month, $year);
my @time = localtime($time);
timelocal() translates your date into seconds, then you throw that back into localtime() and you can get the day of the week out of it (I think it's $time[6], but double check).
Cheers,
Alex
Code:
use Time::Local; my $time = timelocal ($sec, $min, $hour, $day, $month, $year);
my @time = localtime($time);
timelocal() translates your date into seconds, then you throw that back into localtime() and you can get the day of the week out of it (I think it's $time[6], but double check).
Cheers,
Alex