Posted By

arunpjohny on 09/05/07


Tagged

postgres


Versions (?)

Date Add/Substract


 / Published in: SQL
 

URL: http://www.postgresql.org/docs/8.0/interactive/functions-datetime.html

  1. /*
  2. * Subtracting months
  3. */
  4. UPDATE employee SET dateOfBirth = dateOfBirth - interval '1 months'
  5.  
  6. /*
  7. * Adding months
  8. */
  9.  
  10. UPDATE employee SET dateOfBirth = dateOfBirth + interval '1 months'
  11. /*
  12. * You can use one of the following intervals
  13. *--------------------------------------------
  14. * microseconds
  15. * milliseconds
  16. * second
  17. * minute
  18. * hour
  19. * day
  20. * week
  21. * month
  22. * quarter
  23. * year
  24. * decade
  25. * century
  26. * millennium
  27. */

Report this snippet  

You need to login to post a comment.