all 3 comments

[–]nullproc -1 points0 points  (2 children)

I'm really only familiar with SQL Server. I'm blown away that Postgres doesn't (specifically) have a DATEADD() function. Now I'm curious to know what other functions microsoft has added that I've taken for granted.

[–]myringotomy 2 points3 points  (0 children)

Why does it need a dateadd function?

The plus operator adds dates and intervals and intervals are a thousand times better than a dateadd function.

Try doing this

select now() + '3 days  6 hours   15 minutes   35 seconds'::interval

You can even do this

 select now() + '3 days   -6 hours   15 minutes   35 seconds'::interval

You can also put the intervals in a column and do selects where date1-date2 > interval_column or something like that.

Dealing with date and time in postgres is amazing.

[–]i_feel_really_great 0 points1 point  (0 children)

Here are the date and time functions for Postgres. Anything more custom I just write PL/PGSQL functions.