How would datetime be used in a practical way?

python

#1

How would datetime be used in a practical way when coding a project of some kind?


#2

Our programs can tell time, for starters, down to the millionth of a second. !!

>>> from datetime import datetime
>>> now = datetime.now()
>>> now.time()
datetime.time(18, 41, 19, 113252)
>>> 

Of course dates are time nodes in the timeline, so it follows the two are intertwined.

>>> now.date()
datetime.date(2017, 10, 26)
>>> 

The utility has a major role in generating timestamps for transmitted and/or stored data. Timestamps are a finite set, but that set takes many years to repeat (bears further reading).

When we wish (thorry) to know the length of a time interval between dates and times, you won’t find a better tool.than timedelta.

Will need to dig around for some interesting examples. You can use search to suss it out in the forums.

!! C can divide time into 10 million ticks per second, but Python is a million, as far as I understand.