-- DATE operations (Advised : Use TIMESTAMP FORMAT instead of DATE FORMAT to acquire preciseness) SELECT date '2005-09-11' - date '2005-09-10'; -- Result will be an integer as no of days (1) SELECT date '2005-09-11' + integer '3'; -- Result will be a date (2005-09-14) -- TIMESTAMP operations SELECT date '2005-09-11 00:00:00' - date '2005-09-09 12:00:00'; -- Result will be an interval (1 day 12:00:00) SELECT AGE(timestamp '2005-09-11 00:00:00', timestamp '2005-09-09 12:00:00'); -- Result will be an interval (1 day 12:00:00) SELECT timestamp '2019-05-01' + 21 * INTERVAL '1 day'; -- Result will be a new timestamp (2019-05-22 00:00:00) SELECT rental_date + INTERVAL '3 days' AS expected_return_date -- adding timestamp with interval = new timestamp FROM rental; -- Current Timestamp SELECT NOW()::timestamp; -- casting will cut the timezone information SELECT CAST(NOW() as timestamp); SELECT CURRENT_TIMESTAMP(2); -- control precision SELECT CURRENT_DATE; -- current date SELECT CURRENT_TIME; -- current time with timezone information -- Extract date and time information SELECT EXTRACT (month FROM timestamp '2005-01-24 05:12:00') AS month; -- Result will be month (1) SELECT DATE_PART('month', timestamp '2005-01-24 05:12:00') AS month; -- Result will be month (1) SELECT DATE_TRUNC('year', TIMESTAMP '2005-05-21 15:30:30'); -- Result will truncate to specified precision (2005-01-01 00:00:00)