Ich hatte heute das Problem, dass ich aus einer als „DATE“ definierten Spalte einer DB-Tabelle, die Zeit ermitteln sollte. Das DBMS war Oracle und die „schuldige“ Tabelle wie folgt definiert:
Wie man erkennen kann sind die Spalten „Created“ und „Updated“ vom Typ „DATE“. Ich habe in die Spalte „Created“ einen Zeitstempel mit Datum und Uhrzeit eingefügt.
Ein einfaches SELECT-SQL-Statement, like:
select created from ... where ...;
Bringt folgendes Ergebnis:
Da fehlt der Zeitstempel 😦
Nun kann man in „DATE“ Spalten auch Daten ohne Zeitstempel ablegen, aber in diesem Fall war ich mir sicher, dass da auch noch ein Zeitstempel versteckt ist.
Die Lösung:
select to_char(created, 'DD-MON-YYYY HH24:MI:SS') from ... where ...;
Und das Ergebnis:
Datum und Zeitstempel 🙂
Links:
http://psoug.org/reference/timestamp.htmlToday I had a problem with an Oracle database. I had to get the date and the time from a DATE formatted column. The rewarded and „guilty“ table was defined as follows:
The columns „Created“ and „Updated“ are of type „DATE“. To check it out, I inserted a row with a timestamp. But a simple select statement like
select created from ... where ...;
only showd me the date, not the time:
solution:
select to_char(created, 'DD-MON-YYYY HH24:MI:SS') from ... where ...;
result:
Date and time was returned 🙂
Links:
http://psoug.org/reference/timestamp.html



Nachdem ich die ersten Kommentare für meinen Blog erhalten habe, musste ich feststellen, dass Datum und Zeit falsch formatiert waren. Da wurde u.a. immer wieder „%e %B %Y alle %H:%M“ angezeigt. Nach einigem googlen habe ich die Lösung für das Problem auf der Seite http://community.webfaction.com/questions/1492/wordpress-date-time-wrong-in-comments gefunden.
Ich verwende das qTranslate Plugin. Man muss hier als Admin die Einstellungen des qTranslate Plugins aufrufen. Dann auf „Erweiterte Einstellungen“, „Datums- und Zeiteinstellungen“ gehen und diese auf „Benutze strftime anstatt von date.“ setzen.
I experienced a weird problem with date and time format in my blog post comments: they show only something %e %B %Y alle %H:%M instead of correct date & time. If you have the same problem, maybe the following tip (http://community.webfaction.com/questions/1492/wordpress-date-time-wrong-in-comments) will help you:
In your WordPress Admin section, go to Language Management (qTranslate Configuration). Then, click on „Advanced settings“. Make sure „Use strftime instead of date.“ is enabled.
With „Use strftime instead of date“ enabled, your problem should be fixed.
For my WordPress blog it worked fine.
WordPress und qTranslate: Datum und Zeit bei Kommentaren korrekt anzeigen
Teilen mit:
Verfasst von jkhofmann - Mai 9, 2012 in Wordpress
Schlagwörter: comment, date, format, time, wordpress