Problem working with dates and times.

From: "Alejandro Michelin Salomon \( Adinet \)" <alejmsg(at)adinet(dot)com(dot)uy>
To: "Pgsql-General" <pgsql-general(at)postgresql(dot)org>
Subject: Problem working with dates and times.
Date: 2006-12-04 23:13:12
Message-ID: !~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAhx491Ki2tUS42D/aMPFg1MKAAAAQAAAAbsMnEB0imUmFBn2mJIzLuwEAAAAA@adinet.com.uy
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi :

I have some problems working with date and times, in my web page.

I have table with tasks.
This table has :

Inicial date
Inicial hour
Duration
Final Date
Final time

Final Date and Final time are calculate based in Inicial date, Inicial hour,
Duration.

In my test:
Inicial date 2000-12-04
Inicial hour 20:00
Duration 5 (Hours)

Final time = time '"Inicial Hour"' + interval '"Duration" hours'
Ex: Final Time is --> time '20:00' + interval '5 hours' ===> 01:00 ( OK )

The problem cames when i try to add the duration to Inicial date.

if i execute this select :
select '2006-12-04 20:00'::timestamp + interval '5 hours'
the result is ok ( 2006-12-05 01:00:00 )

But i only need 2006-12-05 from the resulting timestamp.

How to cut only the date from this timestamp?

Thanks in advance

Alejandro Michelin Salomon

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2006-12-04 23:14:36 Re: pgsql bug found?
Previous Message Casey Duncan 2006-12-04 23:06:13 Re: n00b RAID + wal hot standby question