Course Content
Dealing with Dates and Times in Python
Dealing with Dates and Times in Python
One More Formatting
Let's practice more with date formats! The table with the most common codes is below.
Format code | Meaning | Example |
%d | Day of the month as a zero-padded decimal number | 01, 02, ..., 30, 31 |
%m | Month as a zero-padded decimal number | 01, 02, ..., 11, 12 |
%y | Year without century as a zero-padded decimal number | 00, 01, 02, ..., 98, 99 |
%Y | Year with century as a decimal number | 0001, 0002, 1999, 2000, 2001, ... |
%b | Month as locale’s abbreviated name | Jan, Feb, ..., Nov, Dec |
%B | Month as locale’s full name | January, February, ..., November, December |
%a | Weekday as locale’s abbreviated name | Sun, Mon, ..., Fri, Sat |
%A | Weekday as locale’s full name | Sunday, Monday, ..., Friday, Saturday |
Task
Format the same date
object as before into the format: "Wednesday, 11 of March, 1998".
Thanks for your feedback!
One More Formatting
Let's practice more with date formats! The table with the most common codes is below.
Format code | Meaning | Example |
%d | Day of the month as a zero-padded decimal number | 01, 02, ..., 30, 31 |
%m | Month as a zero-padded decimal number | 01, 02, ..., 11, 12 |
%y | Year without century as a zero-padded decimal number | 00, 01, 02, ..., 98, 99 |
%Y | Year with century as a decimal number | 0001, 0002, 1999, 2000, 2001, ... |
%b | Month as locale’s abbreviated name | Jan, Feb, ..., Nov, Dec |
%B | Month as locale’s full name | January, February, ..., November, December |
%a | Weekday as locale’s abbreviated name | Sun, Mon, ..., Fri, Sat |
%A | Weekday as locale’s full name | Sunday, Monday, ..., Friday, Saturday |
Task
Format the same date
object as before into the format: "Wednesday, 11 of March, 1998".
Thanks for your feedback!
One More Formatting
Let's practice more with date formats! The table with the most common codes is below.
Format code | Meaning | Example |
%d | Day of the month as a zero-padded decimal number | 01, 02, ..., 30, 31 |
%m | Month as a zero-padded decimal number | 01, 02, ..., 11, 12 |
%y | Year without century as a zero-padded decimal number | 00, 01, 02, ..., 98, 99 |
%Y | Year with century as a decimal number | 0001, 0002, 1999, 2000, 2001, ... |
%b | Month as locale’s abbreviated name | Jan, Feb, ..., Nov, Dec |
%B | Month as locale’s full name | January, February, ..., November, December |
%a | Weekday as locale’s abbreviated name | Sun, Mon, ..., Fri, Sat |
%A | Weekday as locale’s full name | Sunday, Monday, ..., Friday, Saturday |
Task
Format the same date
object as before into the format: "Wednesday, 11 of March, 1998".
Thanks for your feedback!
Let's practice more with date formats! The table with the most common codes is below.
Format code | Meaning | Example |
%d | Day of the month as a zero-padded decimal number | 01, 02, ..., 30, 31 |
%m | Month as a zero-padded decimal number | 01, 02, ..., 11, 12 |
%y | Year without century as a zero-padded decimal number | 00, 01, 02, ..., 98, 99 |
%Y | Year with century as a decimal number | 0001, 0002, 1999, 2000, 2001, ... |
%b | Month as locale’s abbreviated name | Jan, Feb, ..., Nov, Dec |
%B | Month as locale’s full name | January, February, ..., November, December |
%a | Weekday as locale’s abbreviated name | Sun, Mon, ..., Fri, Sat |
%A | Weekday as locale’s full name | Sunday, Monday, ..., Friday, Saturday |
Task
Format the same date
object as before into the format: "Wednesday, 11 of March, 1998".