I have the following snippet in my code that prints "06. Oktober 2016"
<?php
// german umlauts in date not possible without date formatter
$fmt = new IntlDateFormatter('de_DE' ,IntlDateFormatter::FULL, IntlDateFormatter::NONE, 'Europe/Berlin', IntlDateFormatter::GREGORIAN);
$fmt->setPattern("MMMM");
$event_date_format = DateTime::createFromFormat('Ymd', $event_date[0]);
$dateOp = $event_date_format->format('d') . ". " . $fmt->format($event_date_format) . " " . $event_date_format->format('Y');
?>
I want however to also include "Montag, 06. Oktober 2016, 12:33 Uhr"
I can't seem to make that work when using this for instance:
$dateOp = $event_date_format->format('l') . ", " . $event_date_format->format('d') . ". " . $fmt->format($event_date_format) . " " . $event_date_format->format('Y') . ", " . $event_date_format->format('G') . "." . $event_date_format->format('i') ;
Any idea what I have todo to get this information out of the date?
$event_date_format = DateTime::createFromFormat('Ymd', $event_date[0]);) it seems like you are only getting the year, month, and date, and not the hours and minutes that you want.$event_date_format->format('l, d. M , G.i');which gets you much cleaner code.