Date intervals in PostgreSQL

Recently I had to use PostgreSQL date functions. PostgreSQL manual states that it is possible to add an interval to a date using:

select date '2001-09-28' + interval '1 hour'

It doesn’t state that interval can be more complex, like this:

select date '2001-09-28' + interval '5 day 13 hour 11 minute 5 second'

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s