Skip to main content

Utilizing Dates and Times in Python

Hands-On Lab


Photo of

Training Architect





Python is able to work with time quite efficiently, as long as the coder is aware of a few functions.

In the datetime.datetime package:

  • strptime is used to parse a text string representing a datetime object into a datetime object.
  • strftime is used to turn a datetime object into a string representing a datetime object.
  • timedelta can be used to add to or delete a certain amount of time from a datetime object.

You will need basic Python programming and datetime skills for this lab:

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.