tcf03 has asked for the wisdom of the Perl Monks concerning the following question:
and here is how DateTime is using $hour:The 'hour' parameter ("24") to DateTime::new did not pass the 'is betw +een 0 and 23' callback at /usr/lib/perl5/site_perl/5.8.5/DateTime/Format/Epoch.pm line 179
any Ideas about the error?$datetime=DateTime->new( year => 2005, month => $MONTHNUM, day => $FDAY, hour => $hour, minute => $minute, second => 00 );
There is still the messiness of zero padding, but ill figure that out in time - if anyone has suggestions that would be cool.sub minutes_before { my $minutes_b4=shift; my $month=shift; my $day=shift; my $hour=shift; my $minute=shift; # Lets find n minutes before! my $datetime=DateTime->new( year => 2005, month => month_to_num($month), day => $day, hour => $hour, minute => $minute ); $datetime->subtract( minutes => $minutes_b4 ); # This is clumsy, ill use it now # and fix it later if ( $datetime->day < 10 ) { $day="0".$datetime->day; } else { $day=$datetime->day; } if ( $datetime->hour < 10 ) { $hour="0".$datetime->hour; } else { $hour=$datetime->hour; } if ( $datetime->minute < 10 ) { $minute="0".$datetime->minute; } else { $minute=$datetime->minute; } # End of genereal clumsiness... $ready=1; return @MINBEFORE = ( num_to_month($datetime->month), $day, $hour, $minute ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DateTime and hour 0
by RazorbladeBidet (Friar) on Apr 18, 2005 at 13:19 UTC | |
by tcf03 (Deacon) on Apr 18, 2005 at 13:54 UTC | |
|
Re: DateTime and hour 0
by Zaxo (Archbishop) on Apr 18, 2005 at 13:21 UTC | |
|
Re: DateTime and hour 0
by fglock (Vicar) on Apr 18, 2005 at 15:04 UTC | |
by tcf03 (Deacon) on Apr 18, 2005 at 15:51 UTC | |
by Mr. Muskrat (Canon) on Apr 19, 2005 at 11:28 UTC | |
|
Re: DateTime and hour 0
by shemp (Deacon) on Apr 20, 2005 at 22:10 UTC | |
|
Re: DateTime and hour 0
by Mabooka-Mabooka (Sexton) on Apr 21, 2005 at 23:37 UTC | |
by tcf03 (Deacon) on Apr 22, 2005 at 08:49 UTC |