myusuf3 myusuf3 -3 years ago 146
Python Question

Difference between Python datetime vs time modules

I am trying to figure out the differences between the

modules, and what each should be used for.

I know that
provides both dates and time. What is the use of the

Examples would be appreciated and differences concerning timezones would especially be of interest.

Answer Source

the time module is principally for working with unix time stamps; expressed as a floating point number taken to be seconds since the unix epoch. the datetime module can support many of the same operations, but provides a more object oriented set of types, and also has some limited support for time zones.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download