Created
July 20, 2018 15:22
-
-
Save nara-l/519a470209b189fae8158f1493557062 to your computer and use it in GitHub Desktop.
Using interval to add days to date time field Posgres
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # say you want to extend the expiration date for subscription service to 14 days, in postgres you can do that by | |
| update users set expiration_date = expiration_date + interval '14 days'; # users is the table where expiration is stored | |
| # I bet this could work, not tested | |
| update users set expiration_date += interval '14 days'; | |
| # you could do so much more with interval > http://www.postgresqltutorial.com/postgresql-interval/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment