From 63dde60072374b2f7ef2f756d4ab9dff66669793 Mon Sep 17 00:00:00 2001 From: "mkanat%kerio.com" <> Date: Fri, 25 Feb 2005 07:37:47 +0000 Subject: Bug 280500: Replace "DATE_FORMAT()" with Bugzilla::DB function call Patch By Tomas Kopal r=mkanat, a=myk --- whine.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'whine.pl') 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 -- cgit v1.2.3-24-g4f1b