time module vs. datetime module: plain language for beginners
Jinghui Niu
niujinghui at gmail.com
Fri Mar 27 20:31:36 EDT 2015
On Wednesday, March 25, 2015 at 2:17:03 PM UTC-7, Jinghui Niu wrote:
> I am learning python programming. One thing that gives me a lot of confusion is the division of labours between the time module and the datetime module.
>
> As it turns out to be, time module is not only about time, it's about date too. And datetime doesn't natively support timezone, you have to create one for yourself.
>
> Why duplicate datetime module? What is the design rationale between this division? Can't we just have one unified module that deals with dates and times? Could someone please list some situations where the two modules are actually useful in their own ways respectively?
>
> Explanation with not too much jargon is highly appreciated. Thanks in advance.
Thank you all very much for such a great explanation. I have a follow-up question here: what is the best practice in dealing with repeating date/time? I see neither date module nore datetime module natively supports such datatype right now. Thanks.
More information about the Python-list
mailing list