Home
The Toolkit for Online Communities
17711 Community Members, 1 member online, 1955 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Q&A : Calendar : One Message

Forum OpenACS Q&A: Re: Calendar

Collapse
6: Re: Calendar (response to 5)
Posted by Rocco Siffredi on
I'm sorry too :).
I agree with you and now, I´ll try to be more clear.

Imagine this "universe":

time_intervals:

id|interval_id| start_date          | end_date
-----------------------------------------------------------
n|  n        |2004-08-25 06:00:00+02|2004-08-2506:00:00+02

n= a number.

Well, my question -> How can i get the date and the hour split in start-date ? For example, If i want to show the date only.
It´s possible with the timestamptz type.

Thank you very much.

Collapse
8: Re: Calendar (response to 6)
Posted by Orzenil Silva Junior on
Hi,

Supposing you're running postgresql and start_date and end_date are timestampz datatypes you could split date and time with something like this:

for date:

select start_date::DATE from time_intervals

for time:

select start_date::TIME from time_intervals

You could try a real example with acs_objects table in your oacs instalation: select creation_date::DATE from acs_objects

A good reading about dates and times in postgresql is http://techdocs.postgresql.org/techdocs/faqdatesintervals.php . it is a little outdated but still works :)

Collapse
9: Re: Calendar (response to 8)
Posted by Rocco Siffredi on
Thanks Orzenil.

And the force may be with you. :)