summaryrefslogtreecommitdiff
path: root/includes/functions/functions_date.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/functions/functions_date.php')
-rw-r--r--includes/functions/functions_date.php40
1 files changed, 20 insertions, 20 deletions
diff --git a/includes/functions/functions_date.php b/includes/functions/functions_date.php
index 6884576fab..945040d663 100644
--- a/includes/functions/functions_date.php
+++ b/includes/functions/functions_date.php
@@ -2,7 +2,7 @@
// Date Functions that can be used by any page in webtrees
//
// webtrees: Web based Family History software
-// Copyright (C) 2013 webtrees development team.
+// Copyright (C) 2014 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
@@ -19,7 +19,7 @@
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
@@ -92,37 +92,37 @@ function parse_time($timestr)
function format_timestamp($time) {
global $DATE_FORMAT, $TIME_FORMAT;
- $time_fmt=$TIME_FORMAT;
+ $time_fmt = $TIME_FORMAT;
// PHP::date() doesn't do I18N. Do it ourselves....
preg_match_all('/%[^%]/', $time_fmt, $matches);
foreach ($matches[0] as $match) {
switch ($match) {
case '%a':
- $t=date('His', $time);
- if ($t=='000000') {
- $time_fmt=str_replace($match, /* I18N: time format “%a” - exactly 00:00:00 */ WT_I18N::translate('midnight'), $time_fmt);
- } elseif ($t<'120000') {
- $time_fmt=str_replace($match, /* I18N: time format “%a” - between 00:00:01 and 11:59:59 */ WT_I18N::translate('a.m.'), $time_fmt);
- } elseif ($t=='120000') {
- $time_fmt=str_replace($match, /* I18N: time format “%a” - exactly 12:00:00 */ WT_I18N::translate('noon'), $time_fmt);
+ $t = gmdate('His', $time);
+ if ($t == '000000') {
+ $time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 00:00:00 */ WT_I18N::translate('midnight'), $time_fmt);
+ } elseif ($t < '120000') {
+ $time_fmt = str_replace($match, /* I18N: time format “%a” - between 00:00:01 and 11:59:59 */ WT_I18N::translate('a.m.'), $time_fmt);
+ } elseif ($t == '120000') {
+ $time_fmt = str_replace($match, /* I18N: time format “%a” - exactly 12:00:00 */ WT_I18N::translate('noon'), $time_fmt);
} else {
- $time_fmt=str_replace($match, /* I18N: time format “%a” - between 12:00:01 and 23:59:59 */ WT_I18N::translate('p.m.'), $time_fmt);
+ $time_fmt = str_replace($match, /* I18N: time format “%a” - between 12:00:01 and 23:59:59 */ WT_I18N::translate('p.m.'), $time_fmt);
}
break;
case '%A':
- $t=date('His', $time);
- if ($t=='000000') {
- $time_fmt=str_replace($match, /* I18N: time format “%A” - exactly 00:00:00 */ WT_I18N::translate('Midnight'), $time_fmt);
- } elseif ($t<'120000') {
- $time_fmt=str_replace($match, /* I18N: time format “%A” - between 00:00:01 and 11:59:59 */ WT_I18N::translate('A.M.'), $time_fmt);
- } elseif ($t=='120000') {
- $time_fmt=str_replace($match, /* I18N: time format “%A” - exactly 12:00:00 */ WT_I18N::translate('Noon'), $time_fmt);
+ $t = gmdate('His', $time);
+ if ($t == '000000') {
+ $time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 00:00:00 */ WT_I18N::translate('Midnight'), $time_fmt);
+ } elseif ($t < '120000') {
+ $time_fmt = str_replace($match, /* I18N: time format “%A” - between 00:00:01 and 11:59:59 */ WT_I18N::translate('A.M.'), $time_fmt);
+ } elseif ($t == '120000') {
+ $time_fmt = str_replace($match, /* I18N: time format “%A” - exactly 12:00:00 */ WT_I18N::translate('Noon'), $time_fmt);
} else {
- $time_fmt=str_replace($match, /* I18N: time format “%A” - between 12:00:01 and 23:59:59 */ WT_I18N::translate('P.M.'), $time_fmt);
+ $time_fmt = str_replace($match, /* I18N: time format “%A” - between 12:00:01 and 23:59:59 */ WT_I18N::translate('P.M.'), $time_fmt);
}
break;
default:
- $time_fmt=str_replace($match, WT_I18N::digits(gmdate(substr($match, -1), $time)), $time_fmt);
+ $time_fmt = str_replace($match, WT_I18N::digits(gmdate(substr($match, -1), $time)), $time_fmt);
}
}