PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : pgsql Formatierung von timestamp



elrond
30-10-2003, 15:24
ich habe, auch nach dem lesen der handbücher fogendes Problem:

ich versuche aus eine Tabelle namens history daten zu selektieren
++++++++++++++++++++++++++++++++++++++
Table "public.history"
Column | Type | Modifiers
-----------+-----------------------------+-----------
histid | integer | not null
histobjid | character varying(20) | not null
objtypid | integer | not null
histdat | timestamp without time zone | not null
histtext | character varying(150) | not null
Indexes: history_pkey primary key btree (histid)
Foreign Key constraints: $5 FOREIGN KEY (objtypid) REFERENCES objtyp(objtypid) ON UPDATE NO ACTION ON DELETE NO ACTION
++++++++++++++++++++++++++++++++++++++

Ich versuche dabei den timestamp in eine für das frontend brauchbare form zu bringen, unda habe dabei an die funktion "to_char" gedacht.

das hier klappt:
select to_char(timestamp 'now()','HH24:MI');

aber das hier eben nicht:
select to_char(timestamp histdat,'HH24:MI') from history;
od.
select to_char(timestamp 'histdat','HH24:MI') from history;

was mache ich falsch???

Christoph
31-10-2003, 08:12
select to_char(timestamp histdat,'HH24:MI') from history;
was mache ich falsch???
Lasse das "timestamp" mal weg. Das steht im Handbuch um den Input-Datentyp deutlich zu machen, nicht weil es ein Schlüsselwort beim Funktionsaufruf ist.

elrond
03-11-2003, 07:48
danke, das war's... :D