How to get current date - two weeks date using Postgresql?
14,280
SELECT now() - interval '2 week';
This works just fine. What is the exact error you are getting?
Since you are not pulling any data from table test_base
there is no need to include that in a FROM
clause.
Comments
-
AKIWEB almost 2 years
I am working with
Postgresql
database. I need to get date which is two weeks prior to current date usingPostgresql
database.select date(now() - interval '2 week') from test_base
If today's date is
2014-05-08
then above sql should give me2014-04-24
?But somehow above query is not working at all?