Has anyone else out in the cloisters had trouble with the Date::Day module?
All I want is a three character representation of the day in the week for a corresponding date, Seems like a job for Date::day doesn't it?! So why do I NEVER get the correct day back?
Here's a wee noddy script that I knocked up to test this module when the results from the big script containing this module reported rubbish!
#!/usr/bin/perl -w
###############################################################
# Extra Modules should be declared here. #
# All these modules MUST be found on the server attempting to #
# call this script. #
###############################################################
use strict ; # Enforce private
+ variables
use Date::Day ; # Returns the act
+ual day of a date
###############################################################
# Set up variables #
###############################################################
# Date and time variables for headings in Emails/files etc. #
###############################################################
my ($day, $mon, $year) = (localtime) [3,4,5] ;
my $date = sprintf("%02d/%02d/%04d", $day, $mon +=1, $year += 1900);
my $today = undef ;
#####################
print "\n\t\t*** test_day starts ***\n" ;
$day = '9' ;
$mon = '8' ;
$year = '2005' ;
print "\n\t\tDay :: $day" ;
print "\n\t\tMon :: $mon" ;
print "\n\t\tYear :: $year\n" ;
$today = &day($day,$mon,$year) ;
print "\n\t\tToday is a $today\n" ;
print "\n\t\t*** test_day ends ***\n" ;
According to the Date::Day the 9th of August 2005 is a THU!
Have I done something mind blowingly stupid? I've looked and looked and can see nothing wrong with my code, any ideas?
Cheers,
Ronnie
PS Using the current date from localtime - the result is that today is a TUE???????????
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.