summaryrefslogtreecommitdiffstats
path: root/whine.pl
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-02-25 08:37:47 +0100
committermkanat%kerio.com <>2005-02-25 08:37:47 +0100
commit63dde60072374b2f7ef2f756d4ab9dff66669793 (patch)
tree294b30fddd43508bc9fa4d8c3c540ac4bbcd3c8c /whine.pl
parent32882b6e3513fa69185ea5b3d115e70b69ea5362 (diff)
downloadbugzilla-63dde60072374b2f7ef2f756d4ab9dff66669793.tar.gz
bugzilla-63dde60072374b2f7ef2f756d4ab9dff66669793.tar.xz
Bug 280500: Replace "DATE_FORMAT()" with Bugzilla::DB function call
Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=mkanat, a=myk
Diffstat (limited to 'whine.pl')
-rwxr-xr-xwhine.pl8
1 files changed, 6 insertions, 2 deletions
diff --git a/whine.pl b/whine.pl
index 52fbe4e82..97378a178 100755
--- a/whine.pl
+++ b/whine.pl
@@ -118,12 +118,16 @@ if (open(NOMAIL, '<', "$datadir/nomail")) {
}
# get the current date and time from the database
-$sth = $dbh->prepare( 'SELECT DATE_FORMAT( NOW(), "%y,%m,%e,%w,%k,%i")');
+$sth = $dbh->prepare('SELECT ' . $dbh->sql_date_format('NOW()', '%y,%m,%d,%a,%H,%i'));
$sth->execute;
-my ($now_year, $now_month, $now_day, $now_weekday, $now_hour, $now_minute) =
+my ($now_year, $now_month, $now_day, $now_weekdayname, $now_hour, $now_minute) =
split(',', $sth->fetchrow_array);
$sth->finish;
+# As DBs have different days numbering, use day name and convert it
+# to the range 0-6
+my $now_weekday = index("SunMonTueWedThuFriSat", $now_weekdayname) / 3;
+
my @daysinmonth = qw(0 31 28 31 30 31 30 31 31 30 31 30 31);
# Alter February in case of a leap year. This simple way to do it only
# applies if you won't be looking at February of next year, which whining