aboutsummaryrefslogtreecommitdiffstats
path: root/functions/date_functions.php
diff options
context:
space:
mode:
authorJim Hu <jimhu@users.sourceforge.net>2008-12-26 19:32:41 +0000
committerJim Hu <jimhu@users.sourceforge.net>2008-12-26 19:32:41 +0000
commitb4d635e784aa5589a34d3bbadaf3e93482fa4d33 (patch)
tree456daf290e674c99ebaa313325882f5b2c065b71 /functions/date_functions.php
parent65c00ba1223eb97ff618fd661402a74c037c58cd (diff)
downloadphpicalendar-b4d635e784aa5589a34d3bbadaf3e93482fa4d33.tar.gz
phpicalendar-b4d635e784aa5589a34d3bbadaf3e93482fa4d33.tar.bz2
phpicalendar-b4d635e784aa5589a34d3bbadaf3e93482fa4d33.zip
update danish
Diffstat (limited to 'functions/date_functions.php')
-rw-r--r--functions/date_functions.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/functions/date_functions.php b/functions/date_functions.php
index 5239279..96e0c75 100644
--- a/functions/date_functions.php
+++ b/functions/date_functions.php
@@ -107,15 +107,17 @@ function localizeDate($format, $timestamp) {
$year = date("Y", $timestamp);
$month = date("n", $timestamp)-1;
$day = date("j", $timestamp);
- $dayofweek = date("w", $timestamp);
-
- $date = str_replace('%Y', $year, $format);
- $date = str_replace('%e', $day, $date);
- $date = str_replace('%B', $monthsofyear_lang[$month], $date);
- $date = str_replace('%b', $monthsofyearshort_lang[$month], $date);
- $date = str_replace('%A', $daysofweek_lang[$dayofweek], $date);
- $date = str_replace('%a', $daysofweekshort_lang[$dayofweek], $date);
-
+ $dayofweek = date("w", $timestamp);
+ $replacements = array(
+ '%Y' => $year,
+ '%e' => $day,
+ '%B' => $monthsofyear_lang[$month],
+ '%b' => $monthsofyearshort_lang[$month],
+ '%A' => $daysofweek_lang[$dayofweek],
+ '%a' => $daysofweekshort_lang[$dayofweek],
+ '%d' => sprintf("%02d", $day)
+ );
+ $date = str_replace(array_keys($replacements), array_values($replacements), $format);
return $date;
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy