Time and date functions give me headaches!!

From: "Costin Manda" <siderite(at)madnet(dot)ro>
To: pgsql-general(at)postgresql(dot)org
Subject: Time and date functions give me headaches!!
Date: 2005-04-11 09:40:48
Message-ID: 1875.193.226.119.24.1113212448.squirrel@193.226.119.24
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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/

In response to

  • Help!! at 2005-04-11 01:34:44 from Edson Vilhena de Carvalho

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rafael.Hernamperez 2005-04-11 09:53:27 Re: What are the consequences of a bad database design (never
Previous Message Jinane Haddad 2005-04-11 09:39:13 What are the consequences of a bad database design (never seen that before !)