#  Jeff and Bart wrote:
#   >> I need to be able to determine what day of the week a given date is

#   >       print +(localtime)[6]
#   > That prints a 4, but it's already past midnight. FYI sunday is day
zero.--

#  This way it becomes readable:

@days_of_week = (Sun, Mon, Tue, Wednes, Thurs, Fri, Satur);

print "Today it is a $days_of_week[(localtime)[6]]day.";
print "\nOne week ago it was a
$days_of_week[(localtime(time-60*60*24*7))[6]]day, too.";
print "\nTomorrow it will be a
$days_of_week[(localtime(time+60*60*24))[6]]day.";


=result (valid for today):

Today it is a Thursday.
One week ago it was a Thursday, too.
Tomorrow it will be a Friday.

Reply via email to