On Tue, Feb 27, 2007 at 07:47:32AM -0500, Andrew T. Robinson wrote: > Migrating from DB/2 6.1 to PostgreSQL 8.1.4, > > The following work under DB/2, but I can find no analog in the > PostgreSQL documentation: > > time('00:00:00') [there is to_date() and to_timestamp(), but no > to_time()?] Well, you can always use to_timestamp and then cast to time, but this also works: # select "time"('00:00:00'); time ---------- 00:00:00 (1 row) I can't explain the need for the quotes, some kind of grammer issue. > timestamp(u.date, u.time) [where u.date is of type DATE and u.time > is of type TIME] There is the function datetime_pl(date,time) whic does that, but most people just use +' # select '2007-05-02'::date + '22:33:44'::time; ?column? --------------------- 2007-05-02 22:33:44 (1 row) You can wrap it into a simple function if that makes it easier to understand. Oddly, the documentation indeed doesn't list all the functions, but the operators will do what you want also. http://www.postgresql.org/docs/current/static/functions-datetime.html Have a nice day, -- Martijn van Oosterhout <kleptog@xxxxxxxxx> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.
Attachment:
signature.asc
Description: Digital signature