Skip to main content
HomePython

Course

Working with Dates and Times in Python

IntermediateSkill Level
4.8+
2,451 reviews
Updated 11/2025
Learn how to work with dates and times in Python.
Start Course for Free
PythonProgramming4 hr14 videos48 Exercises4,100 XP77,574Statement of Accomplishment

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.

Loved by learners at thousands of companies

Group

Training 2 or more people?

Try DataCamp for Business

Course Description

You'll probably never have a time machine, but how about a machine for analyzing time? As soon as time enters any analysis, things can get weird. It's easy to get tripped up on day and month boundaries, time zones, daylight saving time, and all sorts of other things that can confuse the unprepared. If you're going to do any kind of analysis involving time, you’ll want to use Python to sort it out. Working with data sets on hurricanes and bike trips, we’ll cover counting events, figuring out how much time has elapsed between events and plotting data over time. You'll work in both standard Python and in Pandas, and we'll touch on the dateutil library, the only timezone library endorsed by the official Python documentation. After this course, you'll confidently handle date and time data in any format like a champion.

Prerequisites

Data Manipulation with pandas
1

Dates and Calendars

Hurricanes (also known as cyclones or typhoons) hit the U.S. state of Florida several times per year. To start off this course, you'll learn how to work with date objects in Python, starting with the dates of every hurricane to hit Florida since 1950. You'll learn how Python handles dates, common date operations, and the right way to format dates to avoid confusion.
Start Chapter
2

Combining Dates and Times

Bike sharing programs have swept through cities around the world -- and luckily for us, every trip gets recorded! Working with all of the comings and goings of one bike in Washington, D.C., you'll practice working with dates and times together. You'll parse dates and times from text, analyze peak trip times, calculate ride durations, and more.
Start Chapter
3

Time Zones and Daylight Saving

In this chapter, you'll learn to confidently tackle the time-related topic that causes people the most trouble: time zones and daylight saving. Continuing with our bike data, you'll learn how to compare clocks around the world, how to gracefully handle "spring forward" and "fall back," and how to get up-to-date timezone data from the dateutil library.
Start Chapter
4

Easy and Powerful: Dates and Times in Pandas

To conclude this course, you'll apply everything you've learned about working with dates and times in standard Python to working with dates and times in Pandas. With additional information about each bike ride, such as what station it started and stopped at and whether or not the rider had a yearly membership, you'll be able to dig much more deeply into the bike trip data. In this chapter, you'll cover powerful Pandas operations, such as grouping and plotting results by time.
Start Chapter
Working with Dates and Times in Python
Course
Complete

Earn Statement of Accomplishment

Add this credential to your LinkedIn profile, resume, or CV
Share it on social media and in your performance review
Enroll Now

Don’t just take our word for it

*4.8
from 2,451 reviews
81%
17%
1%
0%
0%
  • Yuvraj
    5 hours ago

  • Luis
    yesterday

  • Jojit
    2 days ago

  • Dami
    2 days ago

  • Adrian
    2 days ago

  • Etornyo Kwame
    2 days ago

Yuvraj

Luis

Jojit

FAQs

What Python libraries are used in this course?

You will use the datetime module in standard Python, pandas for time-aware DataFrames, and the dateutil library for timezone handling.

What datasets does this course use?

You will work with data on hurricanes hitting Florida and bike trip records, using both to practice counting events and calculating elapsed time.

Is this course suitable for beginners?

This is an intermediate course. You should know pandas and basic Python before starting, as the exercises build on data manipulation fundamentals.

Does this course cover time zones and daylight saving time?

Yes. You will learn how to handle time zones and daylight saving time using the dateutil library, which is endorsed by the official Python documentation.

What will I be able to do after completing this course?

You will be able to parse dates in any format, calculate time differences, handle time zones, and plot data over time using both standard Python and pandas.

Join over 19 million learners and start Working with Dates and Times in Python today!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.

Grow your data skills with DataCamp for Mobile

Make progress on the go with our mobile courses and daily 5-minute coding challenges.