fixed some bugs in date sorting.. It is now timezone independent
[squirrelmail.git] / functions / date.php
index 9d153baf9b5f3db79c888b940162e5205213dbcf..bdc0ad586b64529bfdb5e9ebccf36b6a6fb4b355 100644 (file)
 
    function getDateString($stamp) {
       $now = time();
-      $midnight = $now - ($now % 86400) + 14400;
+      $midnight = $now - ($now % 86400) - date("Z", $now);
 
       if ($midnight < $stamp) {
          // Today
          return date("g:i a", $stamp);
-      } else if ($midnight - 604800 < $stamp) {
+      } else if ($midnight - (60 * 60 * 24 * 6) < $stamp) {
          // This week
          return date("D, g:i a", $stamp);
       } else {