diff options
author | mkanat%kerio.com <> | 2005-02-25 07:37:47 +0000 |
---|---|---|
committer | mkanat%kerio.com <> | 2005-02-25 07:37:47 +0000 |
commit | 63dde60072374b2f7ef2f756d4ab9dff66669793 (patch) | |
tree | 294b30fddd43508bc9fa4d8c3c540ac4bbcd3c8c /whine.pl | |
parent | Bug 277504 : quips migrated from quip file have an (invalid) userid of 0 (diff) | |
download | bugzilla-63dde60072374b2f7ef2f756d4ab9dff66669793.tar.gz bugzilla-63dde60072374b2f7ef2f756d4ab9dff66669793.tar.bz2 bugzilla-63dde60072374b2f7ef2f756d4ab9dff66669793.zip |
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-x | whine.pl | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |