1
0
Fork 0
template/functions/date.php
2024-04-25 21:55:08 +02:00

51 lines
No EOL
1.2 KiB
PHP
Executable file

<?php
function date_($timestamp, $format) {
global $get_dateformat, $get_daysuffix, $lang;
$months = Array(
1 => 'Januari',
2 => 'Februari',
3 => 'Mars',
4 => 'April',
5 => 'Maj',
6 => 'Juni',
7 => 'Juli',
8 => 'Augusti',
9 => 'September',
10 => 'Oktober',
11 => 'November',
12 => 'December'
);
if($format == 'datetime') {
return date('Y-m-d, H:i', $timestamp);
} elseif($format == 'date') {
return date('Y-m-d', $timestamp);
} elseif($format == 'time') {
return date('H:i', $timestamp);
} elseif($format == 'year') {
return date('Y', $timestamp);
} elseif($format == 'month') {
return $months[date('n', $timestamp)];
} elseif($format == 'day-month') {
return date('j', $timestamp).' '.mb_strtolower($months[date('n', $timestamp)]);
} elseif($format == 'month-year') {
return $months[date('n', $timestamp)].' '.date('Y', $timestamp);
} elseif($format == 'day-month-year') {
return date('j', $timestamp).' '.mb_strtolower($months[date('n', $timestamp)]).', '.date('Y', $timestamp);
} elseif($format == 'day-month-year-time') {
return date('j', $timestamp).' '.mb_strtolower($months[date('n', $timestamp)]).' '.date('Y', $timestamp).', kl. '.date('H:i', $timestamp);
}
}
?>