aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2012-06-05 22:55:57 +0000
committerplegall <plg@piwigo.org>2012-06-05 22:55:57 +0000
commit1dfe8d5645165d4f9328eda670877149055087ea (patch)
tree9764aff46ea45e46c89b42b567e96ffed56f7c76
parent5136cffb4eabded02d488d95ce7f83a1af1769b9 (diff)
bug 2646 fixed: avoid useless PHP warnings with uncompleted creation date
git-svn-id: http://piwigo.org/svn/trunk@15573 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions.inc.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 8bd33f35e..2096eb79f 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -491,14 +491,23 @@ function format_date($date, $show_time = false, $show_day_name = true)
$formated_date = '';
// before 1970, Microsoft Windows can't mktime
- if ($show_day_name and $ymdhms[0] >= 1970)
+ if ($ymdhms[0] >= 1970 and $ymdhms[1] != 0 and $ymdhms[2] != 0)
{
// we ask midday because Windows think it's prior to midnight with a
// zero and refuse to work
$formated_date.= $lang['day'][date('w', mktime(12,0,0,$ymdhms[1],$ymdhms[2],$ymdhms[0]))];
}
- $formated_date.= ' '.$ymdhms[2];
- $formated_date.= ' '.$lang['month'][(int)$ymdhms[1]];
+
+ if ($ymdhms[2] != 0)
+ {
+ $formated_date.= ' '.$ymdhms[2];
+ }
+
+ if ($ymdhms[1] != 0)
+ {
+ $formated_date.= ' '.$lang['month'][(int)$ymdhms[1]];
+ }
+
$formated_date.= ' '.$ymdhms[0];
if ($show_time and count($ymdhms)>=5 )
{