Spring Deals - hours only!Up to 70% off on all courses and bundles.-Close
Date and time
11. Formatting datetime—other symbols
Padding and Alignment


Perfect! Actually, there are many more symbols that you can use when formatting dates, not just %H, %M, %d,%m, and %Y. For instance:

from datetime import datetime
my_birthday_party = datetime(2018, 10, 3, 16, 0, 0)
'{:%A %I:%M %p}'.format(my_birthday_party)

Result: Wednesday 04:00 PM

As you can see, %A shows the weekday, and %I prints the hour in the 12-hour format. %p prints AM or PM.

You can find other symbols for date formatting at Python's documentation.


Format the important_meeting variable, and print the following sentence:

I have a very important meeting on Tuesday, 02:25 PM.

Stuck? Here's a hint!

You will need to use the following symbols:

  • %A
  • %I
  • %M
  • %p