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


