DateTime EXERCISES

Exercise #1 Create a variable named moscow that holds a datetime.timezone object at +4 hours. Then create a timezone variable […]

Read More

Use pytz Instead

Timezones of pytz Actually, don’t do things manually. The pytz library is here to the rescue. If you don’t already […]

Read More

Timezones

Timezones are variables that hold a value of duration of time (i.e. timedelta), which can be used to calculate how […]

Read More

Challenge: Timed Quiz

aBuild a timed quiz where the user is asked 10 addition and multiplication questions. [questions.py] class Question:     answer = […]

Read More

DateTime Exercises

Exercise #1 Write a function named delorean that takes an integer. Return a datetime that is that many hours ahead […]

Read More

Challenge: Wikipedia Dates

Using the Python docs, and strftime and strptime, make a script that accepts a month and day date in whatever […]

Read More

strftime & strptime

strftime() Date and time formatting is important. strftime – Method to create a string from a datetime. It takes a […]

Read More

Today

Now & Today As you can see, the methods now() and today() will give the same results. The difference is […]

Read More

Time Delta

What Is TimeDelta? timedelta objects represent a duration of time, in days, seconds and/or microseconds. >>> datetime.timedelta(hours=5) datetime.timedelta(0, 18000) >>> […]

Read More

Create Date & Time

The datetime Library >>> import datetime >>> dir(datetime) [‘MAXYEAR’, ‘MINYEAR’, ‘__builtins__’, ‘__cached__’, ‘__doc__’, ‘__file__’, ‘__loader__’, ‘__name__’, ‘__package__’, ‘__spec__’, ‘_divide_and_round’, ‘date’, […]

Read More