Quote:
(I think that this is the appropriate forum for discussing the GT:: Modules, despite the forum description).
I'm trying to determine whether or not the time is before 6pm using GT::Date, but at the moment neither date_is_greater or date_is_smaller returns true. Any ideas how I can overcome this (or what I'm doing wrong?)
Code:
#!/usr/bin/perluse GT::Date qw/:all/;my $days = 4;##### Time Formats ################ $sec_fmt = '%HH%:%MM%:%ss%';
$orig_fmt = '%yyyy%-%mm%-%dd% %HH%:%MM%:%ss%';
###############################
date_set_format($orig_fmt);my $date = date_get();
my $deadline = date_get (time + ($days * 86400)); print qq|Order Date: $date
Deadline: $deadline
|;# If the time is after 6:00pm, then we should give everyone an extra day as it's
# so late in the day.
$now_s = date_transform ($date, $orig_fmt, $sec_fmt);
$sixpm_s = '18:00:00';
date_set_format($sec_fmt); print "Comparing $now_s with $sixpm_s\n";
if (date_is_greater($sixpm_s, $now_s)) {
print "It is after 6pm ($sixpm_s > $now_s )\n";
}
if (date_is_smaller($sixpm_s, $now_s)) {
print "It is before 6pm ($now_s < $sixpm_s)\n";
}
Quote:
date_is_greater[/url] Returns 1 if argument 1 is greater then argument 2, otherwise 0.
date_is_smaller[/url]
Returns 1 if argument 1 is smaller then argument 2, otherwise 0.