Python Tutorial: Datetime Module - How to work with Dates, Times, Timedeltas, and Timezones

  Рет қаралды 543,266

Corey Schafer

Corey Schafer

Күн бұрын

Пікірлер: 402
@asadmoosvi
@asadmoosvi 7 жыл бұрын
In 'strftime,' the 'f' is for 'format,' and in 'strptime,' the 'p' is for 'parse.' Knowing this helps you remember them better. Great video by the way.
@PoeLemic
@PoeLemic 6 жыл бұрын
Brilliant. You should have an Einstein award. Thanks for helping me remember it. I'll never forget how to understand now.
@mattiass4893
@mattiass4893 3 жыл бұрын
Legend
@Soulfulreader786
@Soulfulreader786 3 жыл бұрын
Do u know how to sort date as earliest and latest .also how to convert to quarter and month
@aarongrant1184
@aarongrant1184 2 жыл бұрын
and the 'str' is for 'string'
@АлексейСоков-ь8и
@АлексейСоков-ь8и 2 жыл бұрын
Ha, i used to think 'f' stands for 'from' (like 'get string from time') but still couldn't come up with what 'p' stands for 😅
@roccodivincenzo1858
@roccodivincenzo1858 4 жыл бұрын
Pride of you Corey! You're one of the few ones who do no sell shitty online courses but only share your knowledge with us
@scene2much
@scene2much 5 жыл бұрын
THIS! is the tutorial I've been looking for... makes timezone usage clear, and removes lots of confusion and uncertainty. Thumbs Up!
@aaryareddy9275
@aaryareddy9275 4 жыл бұрын
never commented on any video but trust me you are best at what you are doing. Great work. you make the topics crystal clear.
@jslacasa
@jslacasa Күн бұрын
8 years later and this is still so freaking useful!
@toddstewart4135
@toddstewart4135 4 жыл бұрын
I am new to python. I have been stuck on a datetime problem for over a week now. I have been googling over and over, reading countless forum questions, etc. I watched this video and my problem was solved! Thank you!!!
@Colstonewall
@Colstonewall 8 жыл бұрын
Awesome tutorial, Corey. Datetimes is something I've never been good at, for lack of studying. But, rarely does anyone do a thorough tutorial on in, and that's where you've done a great job! Thanx
@wishaalrk
@wishaalrk 5 жыл бұрын
Thank you very much for the explanation. This is the best video about datetime I've seen so far, keep it up!
@fordsrmaster
@fordsrmaster 3 жыл бұрын
Even though this is an older video, I found it to be a great help in learning the datetime library. Thanks for the video.
@ronmann5810
@ronmann5810 6 жыл бұрын
Man your the best. please keep the videos coming! For some reason I learn well from you, more so than anyone else on youtube.
@df6148
@df6148 5 жыл бұрын
Thank you so much. Within the first 5 mins I was able to gather a lot of useful information that I can already apply to my code. THANK YOU
@martinsteele2576
@martinsteele2576 Жыл бұрын
Brilliant. Watched a few tutorials ... and the framework and concepts only came to light and shone through here. Credit to you. Thank you.
@arindamdas4142
@arindamdas4142 Ай бұрын
8 years still one of the best explanation on internet
@Spec970
@Spec970 8 жыл бұрын
This might not mean much to you, but honestly, I'd like to thank you for taking time out of your probably cluttered schedule to help out new programmers like my self every day. Please keep doing what your doing, and know that yes, you ARE in fact impacting many, many peoples lives. I hope to see more OOP content soon as well as some more helpful programming terms! :)
@coreyms
@coreyms 8 жыл бұрын
That means more than you know. Thanks a lot... I really do appreciate it.
@Spec970
@Spec970 8 жыл бұрын
Corey Schafer Glad to hear that! I'd love to see some more OOP videos as well as a video on threads from you.
@coreyms
@coreyms 8 жыл бұрын
I'll be recording more OOP videos this weekend and hopefully will release some next week. I've been meaning to put together a video on threads and multiprocessing, but there are a few other videos I have in my queue before that. I will try to get around to those as soon as possible though! Thanks.
@PoeLemic
@PoeLemic 6 жыл бұрын
Yes, I even teach other programmers (in past), and Teacher here is really giving me so much knowledge quickly.
@TheMheadCondition
@TheMheadCondition 8 жыл бұрын
Love the explanation. Simple and easy to follow. I was confused about datetime until i saw ur video. Just wanted to say thanks
@kaliberry6159
@kaliberry6159 8 жыл бұрын
Love your python tutorials. By far the best videos on the youtube IMO. Please keep the python videos coming. Your OOP tutorials has helped me understand classes very clearly. Thank you!
@whatarewetoday4585
@whatarewetoday4585 2 жыл бұрын
You are quickly becoming my real teacher
@kumaranda4720
@kumaranda4720 3 жыл бұрын
Happy Birthday, Corey, Just now I have seen and found your DOB (9/24) when you explain about DateTime. It is a coincidence.
@OttoFazzl
@OttoFazzl 8 жыл бұрын
This is another amazing video! I am so glad you are making these videos to let people learn about Python!
@MA-UTUBE-99
@MA-UTUBE-99 4 жыл бұрын
Excellent videos. I am new to python. Used to do engineering/ scientific programming many many (*n! ) years ago. Used Fortran at that time. I am really enjoying learning Python with such clear videos and a user friendly language. May you "Live long and prosper " !!!!!
@rileybarrett6063
@rileybarrett6063 10 ай бұрын
love these videos, I'm in software development and been following all your videos since i started and they greatly improve my understanding .thanks for the video's
@aaronbarber6816
@aaronbarber6816 4 жыл бұрын
Awesome!!! Clear, concise, and quick. As a person new to python, this is exactly what I needed. It will probably take me a couple viewings. THANK YOU
@rio-ty9vr
@rio-ty9vr 2 жыл бұрын
ive been looking everywhere for good information like this, thank you
@luqmanhakim7781
@luqmanhakim7781 4 жыл бұрын
hey Corey ! I just wanted to tell you that I immediately pause watching this video at minute 6:30 because you said your birthday is on 24 September which is the same with me. I'm just happy to have a same birthday date with an amazing person like you :) keep up the good content. I'm younger btw hehe
@mylearnings7319
@mylearnings7319 2 жыл бұрын
I'm not getting the conversion error at 21:15 (when trying to convert naïve datetime to us time zone), I assume some improvisation in datetime module did happened in recent years, your views on this? @Corey Schafer
@nashsok
@nashsok 2 жыл бұрын
Had the same question as you! In the Python documentation: docs.python.org/3/library/datetime.html "Changed in version 3.6: The astimezone() method can now be called on naive instances that are presumed to represent system local time."
@twinkle2404
@twinkle2404 4 жыл бұрын
This is the best video about datetime I've seen so far, keep it up....
@SujeetRaj711
@SujeetRaj711 4 жыл бұрын
Hi Corey, Even 3.5 years later. I found this to be the best explanation after searching around for 2 hrs.... Thank You :) Can you please make the video on Arrow though :)
@dom-i-no2363
@dom-i-no2363 3 жыл бұрын
BRO U LITERALLY JUST SAVED MY LIFE
@sandgaara183
@sandgaara183 5 жыл бұрын
Thanks, man, you reeeally helped me. Only after watching your video I was able to understand the datetime object properly.
@manuelch4589
@manuelch4589 3 жыл бұрын
Great! This is an excellent video for me. It helped me understand the intricacies of working with datetime and timezones. Much appreciated.
@theslaphappychap
@theslaphappychap 3 жыл бұрын
Wow, this is one hell of a helpful video. Corey, thank you so much for this. So incredibly helpful and concise. You rock!
@JorgeEscobarMX
@JorgeEscobarMX 7 ай бұрын
I love these videos, this one is long and still is just an overview of what can you do with dates and times on Python.
@shubhamsaurbhsharma5163
@shubhamsaurbhsharma5163 4 ай бұрын
You made this on 26th July 2016 and I am watching it on same date with different year :)
@IgnatzBratzbatz
@IgnatzBratzbatz 7 жыл бұрын
If I watched this video 8h ago I could save 8h of my life :/ very clearly explained, I appreciate.
@luciddreams1623
@luciddreams1623 3 жыл бұрын
Wowwwww this is my first encounter with your videos... perfect format.. you are saying everything needed.. this is so perfect for how I learn... I hope you have more videos like this but I will watch this first till the end. Subbed !!!
@Valentin439
@Valentin439 2 жыл бұрын
THANK you! The way of you teaching things and clear explanation it's so good. Wish you all the best!!
@ramsrinivasan9600
@ramsrinivasan9600 4 жыл бұрын
Corey: Awesome video on datetime module. You have cleared a lot of my doubts. Thank you very much.
@MrDreadEnd
@MrDreadEnd 2 жыл бұрын
It was an accident but in the comments you indicate datetimes can be added to one another to produce a timedelta. However datetimes can only be subtracted from one another to create a delta. See 6:00 lines 9 and 10
@rebelwilson9936
@rebelwilson9936 2 жыл бұрын
Been looking for some way to do time math and now i found it thank you sir
@fantasyxpress7966
@fantasyxpress7966 4 жыл бұрын
this is a good 27 mins of my learning thank you sir
@henrywoo1668
@henrywoo1668 2 жыл бұрын
Extremely helpful video !
@datastako156
@datastako156 3 жыл бұрын
thank you! from philippines here
@akira_asahi
@akira_asahi 2 жыл бұрын
Thank you for the video. I am grateful for your time and contribution. Kind regards, Akira.
@phantom..9650
@phantom..9650 2 жыл бұрын
That was so comprehensive.Thanks for the toturial.
@PoeLemic
@PoeLemic 6 жыл бұрын
Thank you for showing this. I needed to learn this for my understanding of Python dates. This came at exact right time.
@Austin9435
@Austin9435 8 жыл бұрын
Awesome tutorial! Highly recommended! Perfect speed on the information to really hammer it in. Thank you so much.
@mumenyanyamu2524
@mumenyanyamu2524 6 жыл бұрын
Hi Corey. This video is so good Keep up the good work
@АлександрЖарков-у9ш
@АлександрЖарков-у9ш 4 жыл бұрын
great video, this helped me a lot, thanks, keep doing a videos like this, you are best )
@korleone72
@korleone72 2 жыл бұрын
the lesson is very helpful, thank you very much. it helped me a lot to understand the topic
@vaibhavkrkm
@vaibhavkrkm 4 жыл бұрын
I wonder why someone would have disliked this video 😳 Anyways, love your amazing tutorials, pls keep it up 🤗👍
@athisii_ekhe6167
@athisii_ekhe6167 4 жыл бұрын
As always, the best tutorial for the topic. Thanks
@mh7369
@mh7369 2 жыл бұрын
Excellent tutorial, very clear and concise and has helped to me to better understand a very "grey area" subject. Thank you
@vandrujemesk8651
@vandrujemesk8651 2 жыл бұрын
Ďakujem veľmi pekne za video. Super vysvetlené. Thank you very much for the video. Super explained.
@husseinabukar7081
@husseinabukar7081 4 жыл бұрын
Very interesting time and date zone formatting. (straight to the point saving your time!!) Great
@RamiSobhani
@RamiSobhani 17 күн бұрын
this video needs more views
@carolinewu9657
@carolinewu9657 6 жыл бұрын
THANK YOU!!! Your tutorial is super helpful!!! You're amazing at explaining this stuff!
@dineshds5124
@dineshds5124 3 жыл бұрын
Amazing explanation 🔥 I really impressed by your teaching method 🔥✌️
@heshankumarasinghe3159
@heshankumarasinghe3159 4 жыл бұрын
Thank you... This video is helpful.... Gonna watch it again sometime.....
@jerrylopez8117
@jerrylopez8117 6 жыл бұрын
Good look at datetime , I will use this video as a reference when neeeded.
@VishalSharma-jx9in
@VishalSharma-jx9in 3 жыл бұрын
Bahut sahi sir Thanks very much ❤️❤️
@alexlandherr
@alexlandherr 4 жыл бұрын
Very helpful, I’m writing a lot of stuff involving scheduling time lapse sequences and downloading files from a server. For my time lapse sequences I want the local time and UTC so that they can be inserted as a time stamp in the time lapse images. I’ve already fixed the UTC part but watched this for help.
@narendrar9940
@narendrar9940 4 жыл бұрын
Thanks for very informative and clearly explained videos. 5 Thumbs Ups from me!
@juergenneumann9280
@juergenneumann9280 8 жыл бұрын
Happy Birthday! Thank's for the nice and time saving tutorial!
@jayavardhan0760
@jayavardhan0760 4 жыл бұрын
Enjoyed Every Bit of video. Thanks Man
@himanshuagrawal2014
@himanshuagrawal2014 2 жыл бұрын
excellent information in very precise manner, Stay Blessed brother !!
@ahmadjavid4068
@ahmadjavid4068 7 жыл бұрын
Simple and useful! You're a legend Corey!
@RSlayer001
@RSlayer001 4 жыл бұрын
I'm Like #4,500 apparently Great stuff man!
@alexisdiaz4217
@alexisdiaz4217 8 жыл бұрын
Great refresher! Thank you!
@brendan3966
@brendan3966 4 жыл бұрын
This is great. The datetime module is surprisingly confusing.
@lunatite6451
@lunatite6451 5 жыл бұрын
Thanks excellent tutorial! Gathered a lot of information watching this.
@glorynwogu7905
@glorynwogu7905 Жыл бұрын
Thank you so much for your detailed explanation
@ST-wx6vw
@ST-wx6vw 5 жыл бұрын
Possible Error: Line# 10 at time 07:00. Line #10 says: timedelta = date1 + date2. Actually, subtraction of dates results in timedelta but addtion gives error. For example: >>> print(f'x is {x} and y is {y}') x is 2020-01-07 and y is 2020-01-21 >>> print(f'x-y is {x-y} and y is {type(x-y)}') x-y is -14 days, 0:00:00 and y is >>> print(x+y) Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for +: 'datetime.date' and 'datetime.date' >>>
@rajeshsingha9940
@rajeshsingha9940 2 жыл бұрын
Awesome tutorial. Leaned a lot. Thanks, man.
@morningstar2728
@morningstar2728 6 жыл бұрын
Thanks alot Corey!.. may you have great success ahead!
@kkevinluke
@kkevinluke 5 жыл бұрын
Thank you. My goto channel for py modules.
@fancyaristocrat7450
@fancyaristocrat7450 5 жыл бұрын
Thanks mate, this was of really great help.
@adnanalam482
@adnanalam482 7 жыл бұрын
That's superb , it was too much easy and informative
@dipdowel
@dipdowel 8 жыл бұрын
Hi Corey and thank you for another great tutorial. I wish you mentioned daylight savings as well, I am sure many developers would have found it useful :)
@shreyashkashyap
@shreyashkashyap 3 жыл бұрын
Thanks a lot Sir. I was searching for this.
@DJ-ct6so
@DJ-ct6so Жыл бұрын
Nice video Corey, very instructive. And you're a Libra, just like me. :)
@Raj-sz9pg
@Raj-sz9pg 3 жыл бұрын
There is also .totalseconds() function. And there will be more but this video covered useful things for a analysis field of work
@snpsforyomom
@snpsforyomom 8 жыл бұрын
just started watching your videos, and I'm learning a lot! thanks Corey!
@omkarroxx222
@omkarroxx222 7 жыл бұрын
Thanks a lot, Your Video helped me a lot . i thought datetime module was difficult, but it was not that hard at all.. thank you so much
@kiizasamuel5026
@kiizasamuel5026 Жыл бұрын
Great, You nailed it It’s so helpful thank you
@zachfenton608
@zachfenton608 3 жыл бұрын
thanks, you really helped me understand how it works
@amadormaldonadoemmanuel1926
@amadormaldonadoemmanuel1926 3 жыл бұрын
I really love this video, thank you so much for the info!
@slambodianjones
@slambodianjones 6 жыл бұрын
Great video, helped on part of my project.
@Tamer_Gomaa
@Tamer_Gomaa 3 жыл бұрын
Great detailed explanation, keep going 👍🏼
@claylanzino9749
@claylanzino9749 3 жыл бұрын
Very interesting video, it has been a great help for me. Thanks for sharing...
@ChrisBFWilliams
@ChrisBFWilliams 5 жыл бұрын
I was bored, so I decided to watch a Python video. I'm a Java developer by profession and it would be nice if you had videos in that arena.
@nutifafacudjoeamedior5541
@nutifafacudjoeamedior5541 7 жыл бұрын
Hello Corey, thanks very much for this video. it has helped a lot in the project i am working on.
@kenfitz1
@kenfitz1 5 жыл бұрын
Thank you for your clear and helpful video. This really helps me in my Programming for Business class!!!
@morarsebi1721
@morarsebi1721 7 жыл бұрын
This was great ! :) i solved a date time calculus very fast , thanks to this :) ;)
@tymothylim6550
@tymothylim6550 3 жыл бұрын
Thank you very much for this video! It was really educational and I learnt a lot! :)
@kostiantynkarzhanov9216
@kostiantynkarzhanov9216 Жыл бұрын
Thank you very much for a very good tutorial!
@george480
@george480 4 жыл бұрын
Such great videos made. I hope you are making a lot of money from them.
@WillHampson
@WillHampson 3 жыл бұрын
Man, this was so helpful! Thank you!
@chaitanyayeturi1312
@chaitanyayeturi1312 3 жыл бұрын
First of all, your teaching style is good, and anyone grabs ur teachings easily, and thanks for teaching us. you are the best tutor I have ever come up with in python language. can u suggest any python language book, which is best to go through other than your channel? Moreover, I am a beginner to python language I thoroughly enjoyed ur videos, if u can suggest me best python book to ur sensibility and I guess it suits me and it helps me to learn further (I like physical like books). In case if u written any books related to this language can u suggest one (or) your favorite book, please......................................
@daze8410
@daze8410 5 ай бұрын
Thanks I was able to resolve a bug that was reliant on sunset/sunrise times
@SciHeartJourney
@SciHeartJourney 3 жыл бұрын
This video was awesome; thank you! I'm sure the help file will tell us how to grab the individual time components: date, hour, minute, second. In LabVIEW and other programming environments, there are functions that give you the time from a fixed point in the past as a reference point. I think the date is sometime in the January 1st 1980's, expressed as a number of seconds. It's the most numerically compatible way to deal with dates. I suspect Python has a similar time function too.
Python Tutorial: File Objects - Reading and Writing to Files
24:33
Corey Schafer
Рет қаралды 1,8 МЛН
Ultimate Guide to Datetime! Python date and time objects for beginners
15:50
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
How To Actually Achieve Your Goals in 2025 (Evidence-Based)
15:15
Python Tutorial: if __name__ == '__main__'
8:43
Corey Schafer
Рет қаралды 2 МЛН
Python OOP Tutorial 4: Inheritance - Creating Subclasses
19:40
Corey Schafer
Рет қаралды 1,3 МЛН
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.