Skip to content

Commit

Permalink
Unify date formats
Browse files Browse the repository at this point in the history
We insert dates as '2013-08-28 18:08:48' into the database
and later on query for them like '2013-08-28T18:08:48'.

This breaks for sqlite as it does not have
a designated 'datetime' type. It compares the date
as plain strings, which works for a unified date format only.

Bug 12637

Signed-off-by: Jan Schneider <jan@horde.org>
  • Loading branch information
thomasjfox authored and yunosh committed Nov 22, 2013
1 parent 0637d58 commit 44fd752
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion framework/Alarm/lib/Horde/Alarm/Sql.php
Expand Up @@ -69,7 +69,7 @@ protected function _list($user, Horde_Date $time)
$query = sprintf('SELECT alarm_id, alarm_uid, alarm_start, alarm_end, alarm_methods, alarm_params, alarm_title, alarm_text, alarm_snooze, alarm_internal FROM %s WHERE alarm_dismissed = 0 AND ((alarm_snooze IS NULL AND alarm_start <= ?) OR alarm_snooze <= ?) AND (alarm_end IS NULL OR alarm_end >= ?)%s ORDER BY alarm_start, alarm_end',
$this->_params['table'],
is_null($user) ? '' : ' AND (alarm_uid IS NULL OR alarm_uid = ? OR alarm_uid = ?)');
$dt = $time->setTimezone('UTC')->format('Y-m-d\TH:i:s');
$dt = $time->setTimezone('UTC')->format('Y-m-d H:i:s');
$values = array($dt, $dt, $dt);
if (!is_null($user)) {
$values[] = '';
Expand Down

0 comments on commit 44fd752

Please sign in to comment.