Lid |
|
Ik zal het maar meteen opbiechten , ik heb deze functie (langdate()) van internet gehaald. Maar ik wil hem nu wel kunnen gebruiken.
<?php
////////////
// Config
$weekdays = array("Zondag ", "Maandag ", "Dinsdag ", "Woensdag ", "Donderdag ", "Vrijdag ", "Zaterdag ");
$shortweekdays = array("Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za");
$months = array("Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December");
$shortmonths = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec");
////////////
// Set config to date safe values
foreach ($weekdays as $name => $value2)
$weekdays[$name] = preg_replace("/./", "\\\\\\0", $value2);
foreach ($shortweekdays as $name => $value2)
$shortweekdays[$name] = preg_replace("/./", "\\\\\\0", $value2);
foreach ($months as $name => $value2)
$months[$name] = preg_replace("/./", "\\\\\\0", $value2);
foreach ($shortmonths as $name => $value2)
$shortmonths[$name] = preg_replace("/./", "\\\\\\0", $value2);
////////////
// Declare the function
function langdate($format, $timestamp) {
global $shortweekdays, $months, $weekdays, $shortmonths;
$format = preg_replace("/(?<!\\\\)D/", $shortweekdays[date("w", $timestamp)], $format);
$format = preg_replace("/(?<!\\\\)F/", $months[date("n", $timestamp) - 1], $format);
$format = preg_replace("/(?<!\\\\)l/", $weekdays[date("w", $timestamp)], $format);
$format = preg_replace("/(?<!\\\\)M/", $shortmonths[date("n", $timestamp) - 1], $format);
return date($format, $timestamp);
}
?>
<?php //////////// // Config $weekdays = array("Zondag ", "Maandag ", "Dinsdag ", "Woensdag ", "Donderdag ", "Vrijdag ", "Zaterdag "); $shortweekdays = array("Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za"); $months = array("Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December"); $shortmonths = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"); //////////// // Set config to date safe values foreach ($weekdays as $name => $value2) foreach ($shortweekdays as $name => $value2) $shortweekdays[$name] = preg_replace("/./", "\\\\\\0", $value2); foreach ($months as $name => $value2) foreach ($shortmonths as $name => $value2) $shortmonths[$name] = preg_replace("/./", "\\\\\\0", $value2); //////////// // Declare the function function langdate($format, $timestamp) { global $shortweekdays, $months, $weekdays, $shortmonths; $format = preg_replace("/(?<!\\\\)D/", $shortweekdays[date("w", $timestamp)], $format); $format = preg_replace("/(?<!\\\\)F/", $months[date("n", $timestamp) - 1], $format); $format = preg_replace("/(?<!\\\\)l/", $weekdays[date("w", $timestamp)], $format); $format = preg_replace("/(?<!\\\\)M/", $shortmonths[date("n", $timestamp) - 1], $format); return date($format, $timestamp); } ?>
Ik snap wel dat ik bij $format bv. "ljF" moet invullen, maar wat meot ik dan precies voor de variabele $timestamp invullen?
|