# #100DaysOfCode in Python Transcripts Chapter: Days 1-3: Playing with Datetimes Lecture: Concepts: what did we learn

0:00 Okay, and that was the basic overview of datetimes. How cool was that? Not too bad, not too hard.
0:07 Nice way to start your #100DaysOfCode on Python, right? Alright, so let's do a quick recap of what we covered.
0:14 There wasn't a lot so this will be pretty quick. So we began by importing datetime and date. And we then started to look at the differences
0:23 between datetime and date. So a datetime object, well when we ran datetime.today(), it included the date and the time,
0:32 so we had a timestamp in that object. Whereas when we ran that with just date, we only get the actual date, the calendar date.
0:41 So we the 19th of February 2018, alright. And we found that you can't actually easily combine the two, do maths between the two.
0:51 Okay, not without a lot of conversion. First we gave ourselves a Christmas variable, and we gave it its' actual date,
1:03 which is something you can do with date. You can assign an actual date to an object. Once we did that, we were then actually able to calculate
1:13 the amount of days between Christmas and the current date. So that was just a bit of a little scenario for you to use datetime and date.
1:22 Okay, next we played with timedelta. Now we began by importing timedelta and then we gave ourselves a timedelta object.
1:34 So we set the timedelta length as 4 days and 10 hours. Then we discussed the fact that you can view your timedelta
1:45 in those days and you can view it in seconds, but you can't view it in hours, okay. And that's because it only works in days and seconds.
1:56 And the seconds only go up to a max of the 24 hours of a day. They expect you to do the calculations yourself. And that's what we see here.
2:08 t.seconds / 60 / 60, and then we get our ten hours, okay, matches up there. As a little scenario to try, we wanted to look at the ETA.
2:21 We wanted to add the estimated time of arrival onto the current time. So the current time plus six is that there, that's the object there.
2:34 That's the response there I should say, the calculation. And we were able to add and subtract timedelta from datetimes which is really, really cool
2:46 and makes it really easy. And using string on that, converting it to a string, we got a really nicely formatted timestamp here.
2:56 Very useful for log files right. Alright, your turn. This is where it gets a lot of fun. What I'd like you to do for day three
3:07 is come up with something cool for you to make with datetime or timedelta. Think about perhaps making it a stopwatch, maybe a timer application.
3:20 I actually think a really fun one to make would be a Pomodoro timer. So if you're not familiar with Pomodoro, just go and google it.
3:26 But that would be a really cool way of setting specific timestamps that a user could choose using datetime and what have you.
3:35 So that would be really, really fun. Now I know what you're thinking, datetime is a really deep and in-depth topic,
3:42 but unfortunately we just don't have the time to run it in this course. So I hope you really enjoyed it. Move onto the next video,
3:52 we are keeping it nice and simple for the first day. Expect things to take it up a notch going forward. So enjoy, get cracking, don't waste any time.

Talk Python's Mastodon Michael Kennedy's Mastodon