- [Instructor] A common and somewhat frustrating scenario…involving dates and times,…involves performing mathematical operations…on dates and times themselves.…So for example, given a particular date,…you might want to calculate a date in the future…or the past relative to that date.…We can use the time delta class in Python…to help us with this, and that's what…we're going to look at in this example.…So in your editor, open up timedeltas_start,…and in order to use timedeltas,…we first need to import the correct packages.…
So you can see that I'm already importing…the datetime and date time classes,…so now I'm going to write from datetime…import timedelta.…A timedelta is baseically a span of time.…It's not a particular date, it's not a particular time,…it's a span of time.…And you can use this class to perform…time-based mathematics.…Let's take a look at some examples.…To construct a basic timedelta, all you need to do…is create the timedelta class and pass in…the amount of time that you want the timedelta to represent.…
- Installing Python
- Choosing an editor or IDE
- Working with variables and expressions
- Writing loops
- Using the date, time, and datetime classes
- Reading and writing files
- Fetching internet data
- Parsing and processing HTML
Skill Level Beginner
1. Getting Started
2. Python Basics
3. Working with Dates and Time
4. Working with Files
5. Working with Web Data
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.