diff --git a/include/class.forms.php b/include/class.forms.php
index 8c3ab09970900867cc6d10a43236cdc92e4b6cbb..59bd50d38d79c8cd286c180cb15fbbda565ac1cb 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -1891,7 +1891,7 @@ class DatetimeField extends FormField {
         $name = $name ?: $this->get('name');
         $config = $this->getConfiguration();
         $value = is_int($value)
-            ? DateTime::createFromFormat('U', !$config['gmt'] ? Misc::dbtime($value) : $value) ?: $value
+            ? DateTime::createFromFormat('U', !$config['gmt'] ? Misc::gmtime($value) : $value) ?: $value
             : $value;
         switch ($method) {
         case 'equal':
@@ -1915,7 +1915,8 @@ class DatetimeField extends FormField {
         case 'between':
             foreach (array('left', 'right') as $side) {
                 $value[$side] = is_int($value[$side])
-                    ? DateTime::createFromFormat('U', !$config['gmt'] ? Misc::dbtime($value[$side]) : $value[$side]) ?: $value[$side]
+                    ? DateTime::createFromFormat('U', !$config['gmt']
+                        ? Misc::gmtime($value[$side]) : $value[$side]) ?: $value[$side]
                     : $value[$side];
             }
             return new Q(array(
@@ -1923,14 +1924,16 @@ class DatetimeField extends FormField {
                 "{$name}__lte" => $value['right'],
             ));
         case 'ndaysago':
+            $now = Misc::gmtime();
             return new Q(array(
-                "{$name}__lt" => SqlFunction::NOW(),
-                "{$name}__gte" => SqlExpression::minus(SqlFunction::NOW(), SqlInterval::DAY($value['until'])),
+                "{$name}__lt" => $now,
+                "{$name}__gte" => SqlExpression::minus($now, SqlInterval::DAY($value['until'])),
             ));
         case 'ndays':
+            $now = Misc::gmtime();
             return new Q(array(
-                "{$name}__gt" => SqlFunction::NOW(),
-                "{$name}__lte" => SqlExpression::plus(SqlFunction::NOW(), SqlInterval::DAY($value['until'])),
+                "{$name}__gt" => $now,
+                "{$name}__lte" => SqlExpression::plus($now, SqlInterval::DAY($value['until'])),
             ));
         default:
             return parent::getSearchQ($method, $value, $name);
diff --git a/include/class.misc.php b/include/class.misc.php
index d926200e4ea8c2911c196a5bc83d9b33101d9645..d8f2523045c2628f0fe796ace96ed44e761549ae 100644
--- a/include/class.misc.php
+++ b/include/class.misc.php
@@ -127,8 +127,15 @@ class Misc {
     }
 
     /*Helper get GM time based on timezone offset*/
-    function gmtime() {
-        return time()-date('Z');
+    function gmtime($time=false, $user=false) {
+        global $cfg;
+
+        $tz = new DateTimeZone($user ? $cfg->getDbTimezone($user) : 'UTC');
+        if (!($time = new DateTime($time ?: 'now'))) {
+            // Old standard
+            return time() - date('Z');
+        }
+        return $time->getTimestamp() - $tz->getOffset($time);
     }
 
     /* Needed because of PHP 4 support */
@@ -190,7 +197,7 @@ class Misc {
                 $sel=($hr==$i && $min==$minute)?'selected="selected"':'';
                 $_minute=str_pad($minute, 2, '0',STR_PAD_LEFT);
                 $_hour=str_pad($i, 2, '0',STR_PAD_LEFT);
-                $disp = Format::time($i*3600 + $minute*60 + 1, false, false, 'UTC');
+                $disp = Format::time($i*3600 + $minute*60 + 1);
                 echo sprintf('<option value="%s:%s" %s>%s</option>',$_hour,$_minute,$sel,$disp);
             }
         }
diff --git a/include/staff/ticket-edit.inc.php b/include/staff/ticket-edit.inc.php
index d6312bf0e9893f9b4ea6842abfc6812a598fa29e..c79f36d60285e0732dc46387aa1aea406c9502b6 100644
--- a/include/staff/ticket-edit.inc.php
+++ b/include/staff/ticket-edit.inc.php
@@ -133,7 +133,8 @@ if ($_POST)
                 echo Misc::timeDropdown($hr, $min, 'time');
                 ?>
                 &nbsp;<font class="error">&nbsp;<?php echo $errors['duedate']; ?>&nbsp;<?php echo $errors['time']; ?></font>
-                <em><?php echo __('Time is based on your time zone');?> (GMT <?php echo Format::date(false, false, 'ZZZ'); ?>)</em>
+                <em><?php echo __('Time is based on your time zone');?>
+                    (<?php echo $cfg->getTimezone($thisstaff); ?>)</em>
             </td>
         </tr>
     </tbody>