Best practise for passing time as arguments

Thomas Jollans tjol at tjol.eu
Sat Oct 14 13:44:18 EDT 2017


On 14/10/17 19:34, Stefan Ram wrote:
> ram at zedat.fu-berlin.de (Stefan Ram) writes:
>> a post. Use whatever is appropriate in the special case
>> given, or - to write a general library -, learn the design
>> of a good existing library, like Time4J, first.
> 
>   Though in many cases, an ISO 8601 time string 
>   represented by a (named )Python tuple should
>   be sufficient for a time stamp.
> 
>   E.g., ( year, month, day, hour, minute, seconds,
>   zone_offset ).
> 

Python provides a datetime (also: date, time, timedelta) type. Use it.

https://docs.python.org/3/library/datetime.html

When working with time zones, the standard library needs a little help.
Luckily, there's a module for that. https://pypi.python.org/pypi/pytz

-- Thomas



More information about the Python-list mailing list