Mat Smith
asked on
PostgreSQL - now() minus a number of days from variable
Hi Guys,
A quick one for you - In PG sql I want to select the current date minus a number of days as a variable at TIME ZONE 'US/Pacific'.
For instance
select (now() - cast( :p as integer) AT TIME ZONE 'US/Pacific');
( :p is a number i.e 2 to be passed when running a query ).
I want the above select to return the current date/time AT TIME ZONE 'US/Pacific' minus a number of days .
How can I achive it please ?
A quick one for you - In PG sql I want to select the current date minus a number of days as a variable at TIME ZONE 'US/Pacific'.
For instance
select (now() - cast( :p as integer) AT TIME ZONE 'US/Pacific');
( :p is a number i.e 2 to be passed when running a query ).
I want the above select to return the current date/time AT TIME ZONE 'US/Pacific' minus a number of days .
How can I achive it please ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER