Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Dates
Time
Timestamps
Extract functions
Timezone conversion
Intervals
Current date and time
Revision
39. Summary

Instruction

Fantastic job! It's time to review what we know about date and time.

  • SQL features dates ('2010-01-01'), time ('13:00:00') and timestamps ('2010-01-01 13:00:00').
  • You can compare the above types, use BETWEEN and ORDER BY with them.
  • The function EXTRACT(DAY FROM column) allows to extract certain parts of date/time.
  • Use AT TIME ZONE to switch between time zones.
  • INTERVAL '7' DAY is an interval of 7 days which you can add to/subtract from a timestamp/date.
  • INTERVAL '2-1' YEAR TO MONTH another type of interval, this one is a interval of 2 years and 1 month.
  • For current date and time, you can use CURRENT_DATE, CURRENT_TIME or CURRENT_TIMESTAMP.

Are you ready to practice?

Exercise

Press Next exercise to start our practice.