Forum OpenACS Q&A: Re: learn to debug an error

Collapse
Posted by Jarkko Laine on
Yves,

No, you don't need to and shouldn't use trunc anymore. So your previous solution should've been correct. So use only

date_part('days',current_timestamp - max(coalesce(modified_date, insertion_date)))

or EXTRACT which is the SQL standard (I'm not sure if it works already in 7.3, but in 7.4 sure). Please read http://www.postgresql.org/docs/7.4/interactive/functions-datetime.html for information on how these functions should be used.