This is a very basic practice with Python datetime module and date() class function. To create a date, we can use the date() class (constructor) of the datetime module. The date() class requires three parameters to create a date: year, month, day.
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.
Love the explanation. Simple and easy to follow. I was confused about conversion between datetime and string objects until i saw ur video. Just wanted to say thanks
Hi, I am doing the Python exercise: "how many times so far your birthday has fallen on a Saturday." And thanks to your approach in this video, I solved mine easily. Thanks a ton buddy!!!!!
Hi, I've got a question: I see that I can create a datetime object by using datetime(year, month, date) or date(year, month, date). So what are the differences between these two functions? Thanks in advance!
To whom might be interested: how to combine date and time together: import datetime, date, time # (hours, minutes) _time = time(7, 0) # (year, month, day) _date = date(2018, 6, 11) # Create a datetime object _datetime = datetime.combine(_date, _time)
This is a very basic practice with Python datetime module and date() class function. To create a date, we can use the date() class (constructor) of the datetime module. The date() class requires three parameters to create a date: year, month, day.
I like the way you write the one-line sum function code. It's also my preferred of doing the counting. Cheers!
I'm sure you'll love it!
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.
Thanks for that!
Love the explanation. Simple and easy to follow. I was confused about conversion between datetime and string objects until i saw ur video. Just wanted to say thanks
Excellent!
Hi, I am doing the Python exercise: "how many times so far your birthday has fallen on a Saturday."
And thanks to your approach in this video, I solved mine easily. Thanks a ton buddy!!!!!
Wonderful!
Hi, I've got a question: I see that I can create a datetime object by using datetime(year, month, date) or date(year, month, date). So what are the differences between these two functions? Thanks in advance!
with datetime() function, you can add more elements like hour, minute, second
To whom might be interested:
how to combine date and time together:
import datetime, date, time
# (hours, minutes)
_time = time(7, 0)
# (year, month, day)
_date = date(2018, 6, 11)
# Create a datetime object
_datetime = datetime.combine(_date, _time)
Thanks for sharing!