From: Tomasz Myrta <jasiek@klaster.net>
To: Kumar <sgnerd@yahoo.com.sg>
Cc: psql <pgsql-sql@postgresql.org>
Subject: Re: Problem with timestamp - Pls help
Date: Fri, 19 Sep 2003 16:03:54 +0200
Message-ID: <3F6B0CCA.8030001@klaster.net> (raw)
In-Reply-To: <038501c37eaf$ff68a310$7502a8c0@hdsc.com>
References: <038501c37eaf$ff68a310$7502a8c0@hdsc.com>
> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jasiek@klaster.net, sgnerd@yahoo.com.sg
Subject: Re: Problem with timestamp - Pls help
In-Reply-To: <3F6B0CCA.8030001@klaster.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox