- made the date like Netscape Messenger: if today show time, if this week
[squirrelmail.git] / functions / date.php
index 6384d941aaba267b24590ae9e4846d1be3944457..21326aee6dda8ef92aea1f67c24c79af6500442a 100644 (file)
    }
 
    function getDateString($stamp) {
-      return date("M j, Y", $stamp);
+      $now = time();
+      $midnight = $now - ($now % 86400) + 14400;
+
+      if ($midnight < $stamp) {
+         // Today
+         return date("g:i a", $stamp);
+      } else if ($midnight - 604800 < $stamp) {
+         // This week
+         return date("D, g:i a", $stamp);
+      } else {
+         // before this week 
+         return date("M j, Y", $stamp);
+      }
    }
 
    function getTimeStamp($dateParts) {