Mobile version of this page
Previous:
PayPalSucks.com, can't be good for PayPal
Next:
Techie things I want to buy from ebuyer.com
Creating a user for postgresql
Date formatting in Python or in PostgreSQL (part II)
Quick PostgreSQL optimization story
ALTER TABLE patch
Date formatting in python or in PostgreSQL
Integer division in programming languages
Running simple SQL commands on the command line
Date plus years or months or weeks
List of casts in PostgreSQL
pg_class to check if table exists
Just Oracle and IBM?
Sorting transform function in PostgreSQL
PayPalSucks.com, can't be good for PayPal
Next:
Techie things I want to buy from ebuyer.com
Related blogs
PostgreSQL, MySQL or SQLiteCreating a user for postgresql
Date formatting in Python or in PostgreSQL (part II)
Quick PostgreSQL optimization story
ALTER TABLE patch
Date formatting in python or in PostgreSQL
Integer division in programming languages
Running simple SQL commands on the command line
Date plus years or months or weeks
List of casts in PostgreSQL
pg_class to check if table exists
Just Oracle and IBM?
Sorting transform function in PostgreSQL
Related by category
Adding a year in PostgreSQL
http://www.postgresql.org/docs/7.4/s...tml#OPERATORS-DATETIME-TABLEpostgresql, interval, timestamp
4th of February 2004
Finally I found it. How to add one year to a date in PostgreSQL
SELECT
date('now') + interval '1 year' AS today_in_one_year,
date '2003-12-13' + interval '1 year' AS my_next_birthday ;
date('now') + interval '1 year' AS today_in_one_year,
date '2003-12-13' + interval '1 year' AS my_next_birthday ;
Both return a TIMESTAMP type.







Save this page in del.icio.us
UPDATE: It doesn't return a TIMESTAMP type, it's a DATE type (only 4 bytes).
To get a TIMESTAMP you can do this:
SELECT '2003-12-13' + interval '1 year' AS my_next_birthday;