[ic] Number of days between dates

Davor Ocelic docelic at spinlocksolutions.com
Sat Dec 1 14:41:02 EST 2007


> Presuming you are pulling this info from a sql database, your db probably has
> tools for this as well. You can convert to days, seconds, diff dates and so on.
> Which is faster? I dunno. but you can try the previous Perl reccomendations and
> your db's date tools in a [benchmark]
> 
> It probably depends on how many you have on a page, and anything else you might
> be doing to the result.

Right, if you want to do it directly in Postgres, then if you have two timestamp
fields in the table, this will work:

select to_char(date2 - date1, 'DD') as diff from testtable;

Cya,
-doc


More information about the interchange-users mailing list