• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

Deutsche Formatierung bei Date() aus Datenbank

Werbung:
Hallo,

wie "Es wird gar nichts angezeigt."

mach mal
PHP:
echo $row->Datum;
siehst das Datum im Format YYYY-MM-DD?
dann mach einfach das draus
PHP:
echo strftime('%d.%m.%Y', strtotime('$row->Datum'))";
jetzt müsste es DD.MM.YYYY sein oder?
Wenn das passt kannst ja die kürzel ändern wie möchtest "%d.%B.%Y".

Cheffchen
 
Werbung:
Hallo,

habe das gerade selber getestet, stimmt das %e scheint nicht zu funzen, keine Ahnung wieso, laut Doku müsste das gehen, hm?
Nimm halt %j, ist fast das gleiche nur halt immer dreistellig, also heute "120" oder wenn kleiner als 100 das "078". Wenn die führende null stört kann man die ja mit PHP löschen.

Cheffchen
 
Die Erklärung dafür steht im englischen Manual dazu:
Not all conversion specifiers may be supported by your C library, in which case they will not be supported by PHP's strftime(). Additionally, not all platforms support negative timestamps, so your date range may be limited to no earlier than the Unix epoch. This means that %e, %T, %R and, %D (and possibly others) - as well as dates prior to Jan 1, 1970 - will not work on Windows, some Linux distributions, and a few other operating systems. For Windows systems, a complete overview of supported conversion specifiers can be found at » MSDN.
 
Zurück
Oben