Forum OpenACS Q&A: Response to to_char(now(), 'YYYY') and time zones

Collapse
Posted by Dan Wickstrom on
Use relative times:

openacs4=# select to_char(substr(now() at time zone 'utc',1,19)::timestamp + '1 month'::interval,'MM');
 to_char 
---------
 05
(1 row)

openacs4=# select to_char(substr(now() at time zone 'utc',1,19)::timestamp + '1 year'::interval,'YYYY');
 to_char 
---------
 2002
(1 row)