Adding time to the mix

Lavorare con date e orari in Python

Max Shron

Data Scientist and Author

Dates and Times

Lavorare con date e orari in Python

Dates and Times

# Import datetime
from datetime import datetime
Lavorare con date e orari in Python

Dates and Times

# Import datetime
from datetime import datetime

dt = datetime(
Lavorare con date e orari in Python

Dates and Times

# Import datetime
from datetime import datetime

dt = datetime(2017, 10, 1
Lavorare con date e orari in Python

Dates and Times

# Import datetime
from datetime import datetime

dt = datetime(2017, 10, 1, 15
Lavorare con date e orari in Python

Dates and Times

# Import datetime
from datetime import datetime

dt = datetime(2017, 10, 1, 15, 23, 
Lavorare con date e orari in Python

Dates and Times

# Import datetime
from datetime import datetime

dt = datetime(2017, 10, 1, 15, 23, 25)
Lavorare con date e orari in Python

Dates and Times

# Import datetime
from datetime import datetime

dt = datetime(2017, 10, 1, 15, 23, 25, 500000)
Lavorare con date e orari in Python

Dates and Times

# Import datetime
from datetime import datetime

dt = datetime(year=2017, month=10, day=1, 
              hour=15, minute=23, second=25, 
              microsecond=500000)
Lavorare con date e orari in Python

Replacing parts of a datetime

print(dt)
2017-10-01 15:23:25.500000
dt_hr = dt.replace(minute=0, second=0, microsecond=0)
print(dt_hr)
2017-10-01 15:00:00
Lavorare con date e orari in Python

Capital Bikeshare

Lavorare con date e orari in Python

Adding time to the mix

Lavorare con date e orari in Python

Preparing Video For Download...