|
@@ -37,26 +37,26 @@ function getGMTSeconds($stamp, $tzc) {
|
|
case 'PST':
|
|
case 'PST':
|
|
$tzc = '-0800';
|
|
$tzc = '-0800';
|
|
break;
|
|
break;
|
|
- case 'Mountain':
|
|
|
|
- case 'MST':
|
|
|
|
- case 'PDT':
|
|
|
|
- $tzc = '-0700';
|
|
|
|
|
|
+ case 'Mountain':
|
|
|
|
+ case 'MST':
|
|
|
|
+ case 'PDT':
|
|
|
|
+ $tzc = '-0700';
|
|
break;
|
|
break;
|
|
case 'Central':
|
|
case 'Central':
|
|
case 'CST':
|
|
case 'CST':
|
|
- case 'MDT':
|
|
|
|
- $tzc = '-0600';
|
|
|
|
|
|
+ case 'MDT':
|
|
|
|
+ $tzc = '-0600';
|
|
break;
|
|
break;
|
|
case 'Eastern':
|
|
case 'Eastern':
|
|
case 'EST':
|
|
case 'EST':
|
|
- case 'CDT':
|
|
|
|
- $tzc = '-0500';
|
|
|
|
|
|
+ case 'CDT':
|
|
|
|
+ $tzc = '-0500';
|
|
break;
|
|
break;
|
|
case 'EDT':
|
|
case 'EDT':
|
|
$tzc = '-0400';
|
|
$tzc = '-0400';
|
|
break;
|
|
break;
|
|
- case 'GMT':
|
|
|
|
- $tzc = '+0000';
|
|
|
|
|
|
+ case 'GMT':
|
|
|
|
+ $tzc = '+0000';
|
|
break;
|
|
break;
|
|
case 'BST':
|
|
case 'BST':
|
|
case 'MET':
|
|
case 'MET':
|
|
@@ -64,17 +64,17 @@ function getGMTSeconds($stamp, $tzc) {
|
|
$tzc = '+0100';
|
|
$tzc = '+0100';
|
|
break;
|
|
break;
|
|
case 'EET':
|
|
case 'EET':
|
|
- case 'IST':
|
|
|
|
- case 'MET DST':
|
|
|
|
- case 'METDST':
|
|
|
|
- $tzc = '+0200';
|
|
|
|
|
|
+ case 'IST':
|
|
|
|
+ case 'MET DST':
|
|
|
|
+ case 'METDST':
|
|
|
|
+ $tzc = '+0200';
|
|
break;
|
|
break;
|
|
- case 'HKT':
|
|
|
|
- $tzc = '+0800';
|
|
|
|
|
|
+ case 'HKT':
|
|
|
|
+ $tzc = '+0800';
|
|
break;
|
|
break;
|
|
- case 'JST':
|
|
|
|
|
|
+ case 'JST':
|
|
case 'KST':
|
|
case 'KST':
|
|
- $tzc = '+0900';
|
|
|
|
|
|
+ $tzc = '+0900';
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
$neg = false;
|
|
$neg = false;
|
|
@@ -86,14 +86,14 @@ function getGMTSeconds($stamp, $tzc) {
|
|
$hh = substr($tzc,1,2);
|
|
$hh = substr($tzc,1,2);
|
|
$mm = substr($tzc,3,2);
|
|
$mm = substr($tzc,3,2);
|
|
$iTzc = ($hh * 60 + $mm) * 60;
|
|
$iTzc = ($hh * 60 + $mm) * 60;
|
|
- if ($neg) $iTzc = -1 * (int) $iTzc;
|
|
|
|
|
|
+ if ($neg) $iTzc = -1 * (int) $iTzc;
|
|
/* stamp in gmt */
|
|
/* stamp in gmt */
|
|
$stamp -= $iTzc;
|
|
$stamp -= $iTzc;
|
|
/** now find what the server is at **/
|
|
/** now find what the server is at **/
|
|
$current = date('Z', time());
|
|
$current = date('Z', time());
|
|
/* stamp in local timezone */
|
|
/* stamp in local timezone */
|
|
$stamp += $current;
|
|
$stamp += $current;
|
|
-
|
|
|
|
|
|
+
|
|
return $stamp;
|
|
return $stamp;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -176,7 +176,7 @@ function getDayAbrv( $day_number ) {
|
|
/**
|
|
/**
|
|
* Returns the (localized) string for a given month number.
|
|
* Returns the (localized) string for a given month number.
|
|
*
|
|
*
|
|
- * @param string month_number the month number (01..12)
|
|
|
|
|
|
+ * @param string month_number the month number (01..12)
|
|
* @return string the month name in human readable form
|
|
* @return string the month name in human readable form
|
|
*/
|
|
*/
|
|
function getMonthName( $month_number ) {
|
|
function getMonthName( $month_number ) {
|
|
@@ -227,7 +227,7 @@ function getMonthName( $month_number ) {
|
|
* Returns the (localized) string for a given month number,
|
|
* Returns the (localized) string for a given month number,
|
|
* short representation.
|
|
* short representation.
|
|
*
|
|
*
|
|
- * @param string month_number the month number (01..12)
|
|
|
|
|
|
+ * @param string month_number the month number (01..12)
|
|
* @return string the shortened month in human readable form
|
|
* @return string the shortened month in human readable form
|
|
*/
|
|
*/
|
|
function getMonthAbrv( $month_number ) {
|
|
function getMonthAbrv( $month_number ) {
|
|
@@ -286,7 +286,7 @@ function date_intl( $date_format, $stamp ) {
|
|
// to reduce the date calls we retrieve m and w in the same call
|
|
// to reduce the date calls we retrieve m and w in the same call
|
|
$ret = date('w#m#'. $ret, $stamp );
|
|
$ret = date('w#m#'. $ret, $stamp );
|
|
// extract day and month in order to replace later by intl day and month
|
|
// extract day and month in order to replace later by intl day and month
|
|
- $aParts = explode('#',$ret);
|
|
|
|
|
|
+ $aParts = explode('#',$ret);
|
|
$ret = str_replace(array('$1','$4','$2','$3',), array(getDayAbrv($aParts[0]),
|
|
$ret = str_replace(array('$1','$4','$2','$3',), array(getDayAbrv($aParts[0]),
|
|
getMonthAbrv($aParts[1]),
|
|
getMonthAbrv($aParts[1]),
|
|
getMonthName($aParts[1]),
|
|
getMonthName($aParts[1]),
|
|
@@ -306,7 +306,7 @@ function date_intl( $date_format, $stamp ) {
|
|
function getLongDateString( $stamp ) {
|
|
function getLongDateString( $stamp ) {
|
|
|
|
|
|
global $hour_format;
|
|
global $hour_format;
|
|
-
|
|
|
|
|
|
+
|
|
if ($stamp == -1) {
|
|
if ($stamp == -1) {
|
|
return '';
|
|
return '';
|
|
}
|
|
}
|
|
@@ -316,7 +316,7 @@ function getLongDateString( $stamp ) {
|
|
} else {
|
|
} else {
|
|
$date_format = _("D, F j, Y G:i");
|
|
$date_format = _("D, F j, Y G:i");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return( date_intl( $date_format, $stamp ) );
|
|
return( date_intl( $date_format, $stamp ) );
|
|
|
|
|
|
}
|
|
}
|
|
@@ -338,19 +338,19 @@ function getDateString( $stamp ) {
|
|
if ( $stamp == -1 ) {
|
|
if ( $stamp == -1 ) {
|
|
return '';
|
|
return '';
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
$now = time();
|
|
$now = time();
|
|
-
|
|
|
|
|
|
+
|
|
$dateZ = date('Z', $now );
|
|
$dateZ = date('Z', $now );
|
|
|
|
|
|
// FIXME: isn't this obsolete and introduced as a terrible workaround
|
|
// FIXME: isn't this obsolete and introduced as a terrible workaround
|
|
- // for bugs at other places which are fixed a long time ago?
|
|
|
|
|
|
+ // for bugs at other places which are fixed a long time ago?
|
|
if ($invert_time) {
|
|
if ($invert_time) {
|
|
$dateZ = - $dateZ;
|
|
$dateZ = - $dateZ;
|
|
}
|
|
}
|
|
$midnight = $now - ($now % 86400) - $dateZ;
|
|
$midnight = $now - ($now % 86400) - $dateZ;
|
|
$nextmid = $midnight + 86400 - $dateZ;
|
|
$nextmid = $midnight + 86400 - $dateZ;
|
|
-
|
|
|
|
|
|
+
|
|
if (($show_full_date == 1) || ($nextmid < $stamp)) {
|
|
if (($show_full_date == 1) || ($nextmid < $stamp)) {
|
|
$date_format = _("M j, Y");
|
|
$date_format = _("M j, Y");
|
|
} else if ($midnight < $stamp) {
|
|
} else if ($midnight < $stamp) {
|
|
@@ -371,7 +371,7 @@ function getDateString( $stamp ) {
|
|
/* before this week */
|
|
/* before this week */
|
|
$date_format = _("M j, Y");
|
|
$date_format = _("M j, Y");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return( date_intl( $date_format, $stamp ) );
|
|
return( date_intl( $date_format, $stamp ) );
|
|
}
|
|
}
|
|
|
|
|
|
@@ -395,13 +395,22 @@ function getTimeStamp($dateParts) {
|
|
** and everything would be bumped up one.
|
|
** and everything would be bumped up one.
|
|
**/
|
|
**/
|
|
|
|
|
|
- /*
|
|
|
|
|
|
+ /*
|
|
* Simply check to see if the first element in the dateParts
|
|
* Simply check to see if the first element in the dateParts
|
|
* array is an integer or not.
|
|
* array is an integer or not.
|
|
* Since the day of week is optional, this check is needed.
|
|
* Since the day of week is optional, this check is needed.
|
|
*/
|
|
*/
|
|
if (count($dateParts) <2) {
|
|
if (count($dateParts) <2) {
|
|
return -1;
|
|
return -1;
|
|
|
|
+ } else if (count($dateParts) ==3) {
|
|
|
|
+ if (substr_count($dateParts[0],'-') == 2 &&
|
|
|
|
+ substr_count($dateParts[1],':') == 2) {
|
|
|
|
+ // dd-Month-yyyy 23:19:05 +0200
|
|
|
|
+ // redefine the date
|
|
|
|
+ $aDate = explode('-',$dateParts[0]);
|
|
|
|
+ $newDate = array($aDate[0],$aDate[1],$aDate[2],$dateParts[1],$dateParts[2]);
|
|
|
|
+ $dateParts = $newDate;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/* remove day of week */
|
|
/* remove day of week */
|