From: | Csaba Nagy <nagy(at)ecircle-ag(dot)com> |
---|---|
To: | Costin Manda <siderite(at)madnet(dot)ro> |
Cc: | Postgres general mailing list <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Time and date functions give me headaches!! |
Date: | 2005-04-11 10:07:05 |
Message-ID: | 1113214025.24663.4.camel@coppola.muc.ecircle.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Costin,
You could probably use one of the functions listed here:
file:///usr/share/doc/postgresql-7.4.2/html/functions-formatting.html
If you want the varchar -> date conversion to happen automatically, you
should study this chapter:
file:///usr/share/doc/postgresql-7.4.2/html/typeconv.html
HTH,
Csaba.
On Mon, 2005-04-11 at 11:40, Costin Manda wrote:
> Hello,
>
> I have a table with columns defines as varchar that have values in format
> 'YYYY-MM-DD HH:MM:SS'.
>
> Now, if I do a
> select timestamp '2005-10-10 10:10:10';
> I get the value just fine. I can use abstime()::integer on the result to
> find the unix timestamp. (This is the simplest way I could find, are there
> any others?)
>
> However, when I try doing the same with the values in the table I can't
> get it to work.
>
> select timestamp setuptime from billing; - error
> select timestamp(setuptime) from billing; - error
> select setuptime::timestamp from billing; - error (cannot cast type
> character varying to timestamp without timezone!?)
>
> So, how can I convert this string into a timestamp, pleeease! :(
>
>
>
>
> -------------------------
> E-Mail powered by MadNet.
> http://www.madnet.ro/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
From | Date | Subject | |
---|---|---|---|
Next Message | Sean Davis | 2005-04-11 10:07:24 | Re: [SQL] Problems with Set Returning Functions (SRFs) |
Previous Message | Sebastian Hennebrueder | 2005-04-11 10:05:37 | Asyncron replication from wan to lan with PostgreSQL 8 |