Oto Shavadze
Oto Shavadze

Reputation: 42753

Adding interval to current timestamp in PostgreSQL

I want to add an interval of 23 hours to the current date and time in PostgreSQL. The query should look something like the following:

SELECT timestamp LOCALTIMESTAMP(0) + interval '23 hours';

For some reason, the preceding statement returns an error. What could be wrong here and why is it not working?

Upvotes: 0

Views: 1663

Answers (1)

Anuj Patel
Anuj Patel

Reputation: 17839

Remove TimeStamp keyword

SELECT LOCALTIMESTAMP(0) + interval '23 hours'

or use

SELECT now() + interval '23 hours'

Upvotes: 3

Related Questions