Skip to content

Instantly share code, notes, and snippets.

@nara-l
Created July 20, 2018 15:22
Show Gist options
  • Save nara-l/519a470209b189fae8158f1493557062 to your computer and use it in GitHub Desktop.
Save nara-l/519a470209b189fae8158f1493557062 to your computer and use it in GitHub Desktop.
Using interval to add days to date time field Posgres
# 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