The current_date will return today’s date. Add or subtract a number from the CURRENT_DATE, and you are adding or subtracting days from the date. For example, subtracting from two dates, you get the number of days between the two dates.

Above are the keywords you can utilize to get the date or timestamp. These are reserved words that the system will deliver to you when requested.

You use the TO_CHAR function to format dates.

The example below shows how robust the EXTRACT command is at extracting portions of a date, time, or timestamp.

You can extract the decade, day of the week (DOW), and the day of the year (DOY).

The below examples use the date_part function to get the subfields. The text parameter needs to be a string value, not a name, so don’t forget your single quotes.

You can use the to_char extension to extract portions of a date.

The AGE command will tell you the time difference (age) between dates, times, or timestamps.

The below examples use the Date_Trunc function to get the subfields. The text parameter needs to be a string value, not a name, so don’t forget your single quotes. Date_Trunc selects which precision to truncate the input value. The return value is of type timestamp or interval. The valid text names are microseconds, milliseconds, second, minute, hour, day, week, month, quarter, year, decade, century, and millennium.

The examples below show you how to use day, month, and year intervals.