Autumn Offers - hours only!Up to 80% off on all courses and bundles.-Close
Dealing with dates
Working with time
Date and time data types in PostgreSQL
Extracting dates and times
24. DATE_PART() – example
Timezone conversion
Format date and time
Current date and time data


Great! How can we use this function? For instance, we can use it to change the way dates are shown. Take a look:

  DATE_PART('day', launched_timestamp)
    || '-'
    || DATE_PART('month', launched_timestamp)
    || '-'
    || DATE_PART('year', launched_timestamp)
    AS launched_date
FROM aircraft;

As a result, we get dates like '10-03-2012' instead of '2012-03-10'. However PostgreSQL implements various functions to work with time and date to format them. We will meet these functions in the next section of the course.


For each route, show its code and the departure time in the following format:, where hh is the hour and mm minutes. Name this new column departure_hour_minute.

Stuck? Here's a hint!

Use the concatenation sign || twice and don't forget about the dot between the hour and minute.