X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1F4E7D1B506 for ; Fri, 19 Sep 2003 14:05:28 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 47610-04 for ; Fri, 19 Sep 2003 11:04:59 -0300 (ADT) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by svr1.postgresql.org (Postfix) with ESMTP id 1EBFFD1B507 for ; Fri, 19 Sep 2003 11:04:55 -0300 (ADT) Received: from klaster.net (core-1.citynet.pl [80.48.135.69]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id BC6BD2B3D0; Fri, 19 Sep 2003 16:03:35 +0200 (CEST) Message-ID: <3F6B0CCA.8030001@klaster.net> Date: Fri, 19 Sep 2003 16:03:54 +0200 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; rv:1.5a) Gecko/20030718 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: Kumar Cc: psql Subject: Re: Problem with timestamp - Pls help References: <038501c37eaf$ff68a310$7502a8c0@hdsc.com> In-Reply-To: <038501c37eaf$ff68a310$7502a8c0@hdsc.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/197 X-Sequence-Number: 15175 > Dear Friends, > > I am using Postgres 7.3.4 on Linux server 7.3. > > I wanted to update one column of my table with now() or timestamp. And I > want that timestamp of format ------------------------ > 2003-09-19 18:39:08.13 > > To achieve this I have used the following > > wats=# select now(); > now > ------------------------------ > 2003-09-19 18:39:58.62398+00 > (1 row) > > wats=# select substr(now(),1,22); > substr > ------------------------ > 2003-09-19 18:40:01.25 > (1 row) > > wats=# select timestamp(substr(now(),1,22)); > ERROR: parser: parse error at or near "substr" at character 18 select substr(now(),1,22)::timestamp or select cast(substr(now(),1,22) as timestamp) > Also I cant directly update my timestamp column as follows > > > update "WATS".users set to_rec_modified_date = substr(now(),1,22); > > ERROR: column "rec_modified_date" is of type timestamp without time > zone but expression is of type text > You will need to rewrite or cast the expression Use syntax above. Regards, Tomasz Myrta