#Day8 – Datetime CheatSheet in Python

Posted by

Today we will be discussing the common operations using the Datetime Library in Python

1. Get Current Datetime

image.png

2. Datetime to a string in the desired format

image.png

Check out this resource more for examples

3. String to Datetime

image.png

4. Getting Week Number from the Date time object

image.png

5. Arithmetic with Datetime

image.png

6. Get all the days in a year

image.png

7. Get all the dates of all Mondays in a year

image.png

8 . Datetime comparison

image.png

9. Difference b/w datetime objects

10. Timezones

image.png