* <Tue,> 29 Jun 1999 09:52:11 -0500 (EDT)
* (as specified in RFC 822) -- 'Tue' is optional
*
- * $Id$
+ * @version $Id$
* @package squirrelmail
+ * @subpackage date
*/
/** Load up some useful constants */
$aParts = explode('#',$ret);
$ret = str_replace(array('$1','$4','$2','$3',), array(getDayAbrv($aParts[0]),
getMonthAbrv($aParts[1]),
- getMonthName($aParts[1]),
- getDayName($aParts[0])),
- $aParts[2]);
+ getMonthName($aParts[1]),
+ getDayName($aParts[0])),
+ $aParts[2]);
return( $ret );
}
if ($invert_time) {
$dateZ = - $dateZ;
}
+
+ // calculate when it was midnight and when it will be,
+ // in order to display dates differently if they're 'today'
$midnight = $now - ($now % 86400) - $dateZ;
- $nextmid = $midnight + 86400 - $dateZ;
+ // this is to correct if after calculations midnight is more than
+ // one whole day away.
+ if ($now - $midnight > 86400) {
+ $midnight += 86400;
+ }
+ $nextmid = $midnight + 86400;
if (($show_full_date == 1) || ($nextmid < $stamp)) {
$date_format = _("M j, Y");