Best practise for passing time as arguments

Christopher Reimer christopher_reimer at icloud.com
Sat Oct 14 17:29:11 EDT 2017


On Oct 14, 2017, at 10:44 AM, Thomas Jollans <tjol at tjol.eu> wrote:
> 
>> 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
> -- 
> https://mail.python.org/mailman/listinfo/python-list

I wrote a blog post about muddling through the timestamp problem, showing examples for datetime, slice-and-dice text, and pytz. Since I was dealing with time zone-specific timestamps, I went with pytz in the end.

https://www.kickingthebitbucket.com/2017/04/04/the-python-time-zone-rabbit-hole/

Chris R.


More information about the Python-list mailing list