diff --git a/include/class.misc.php b/include/class.misc.php
index 69063c44229556fa6e1467224bfb4e01dc9d0604..0de812b734201d406817aadb952deb508832d1e7 100644
--- a/include/class.misc.php
+++ b/include/class.misc.php
@@ -80,6 +80,28 @@ class Misc {
         return $dbtime - $dbtz->getOffset($D);
     }
 
+    // Take user's time and return GMT time.
+    function user2gmtime($timestamp=null, $user=null) {
+        global $cfg;
+
+        $tz = new DateTimeZone($cfg->getTimezone($user));
+
+        if (!$timestamp)
+            $timestamp = 'now';
+
+        if (is_int($timestamp)) {
+            $time = $timestamp;
+        } else {
+            $date = new DateTime($timestamp, $tz);
+            $time = $date->format('U');
+        }
+
+        if (!($D = DateTime::createFromFormat('U', $time)))
+            return $time;
+
+        return $time - $tz->getOffset($D);
+    }
+
     //Take user time or gmtime and return db (mysql) time.
     function dbtime($var=null){
         static $dbtz;
@@ -88,13 +110,11 @@ class Misc {
         if (is_null($var) || !$var) {
             // Default timezone is set to UTC
             $time = time();
+        } else {
+            // User time to UTC
+            $time = self::user2gmtime($var);
         }
-        else { //user time to UTC
-            $tz = new DateTimeZone($cfg->getTimezone());
-            $time = is_int($var) ? $var : strtotime($var);
-            $D = DateTime::createFromFormat('U', $time);
-            $time -= $tz->getOffset($D);
-        }
+
         if (!isset($dbtz)) {
             $dbtz = new DateTimeZone($cfg->getDbTimezone());
         }
diff --git a/include/class.ticket.php b/include/class.ticket.php
index 036e80354655c664fa32bebc3386cc9fe81c42b0..43e74d1756d63ce47869d026d32f39cef608626f 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -2732,8 +2732,7 @@ implements RestrictedAccess, Threadable {
                 $errors['time']=__('Select a time from the list');
             elseif (strtotime($vars['duedate'].' '.$vars['time']) === false)
                 $errors['duedate']=__('Invalid due date');
-            // FIXME: Using time() violates database and user timezone
-            elseif (strtotime($vars['duedate'].' '.$vars['time']) <= time())
+            elseif (Misc::user2gmtime($vars['duedate'].' '.$vars['time']) <= Misc::user2gmtime())
                 $errors['duedate']=__('Due date must be in the future');
         }
 
@@ -3083,13 +3082,13 @@ implements RestrictedAccess, Threadable {
         if(!Validator::process($fields, $vars, $errors) && !$errors['err'])
             $errors['err'] =__('Missing or invalid data - check the errors and try again');
 
-        //Make sure the due date is valid
-        if($vars['duedate']) {
-            if(!$vars['time'] || strpos($vars['time'],':')===false)
+        // Make sure the due date is valid
+        if ($vars['duedate']) {
+            if (!$vars['time'] || strpos($vars['time'],':') === false)
                 $errors['time']=__('Select a time from the list');
-            elseif(strtotime($vars['duedate'].' '.$vars['time'])===false)
+            elseif (strtotime($vars['duedate'].' '.$vars['time']) === false)
                 $errors['duedate']=__('Invalid due date');
-            elseif(strtotime($vars['duedate'].' '.$vars['time'])<=time())
+            elseif (Misc::user2gmtime($vars['duedate'].' '.$vars['time']) <= Misc::user2gmtime())
                 $errors['duedate']=__('Due date must be in the future');
         }