mktime, how to handle dates before 01-01-1970 ?

Stephen Hansen apt.shansen at
Tue Oct 6 02:25:09 CEST 2009

On Mon, Oct 5, 2009 at 4:54 PM, Stef Mientki <stef.mientki at> wrote:

> hello,
> I want to handle datetime vars in a general way, so I use the default
> time-format,
> so I can use the standard cinversion procedures.

Personally, I love mx.DateTime; its the best date/time library around. But,
Python's built in datetime isn't too bad and is similar and built-in if you
don't want to use a third-party library.


>>> birthday = mx.DateTime.Date(1960,3,3)
>>> birthday
<mx.DateTime.DateTime object for '1960-03-03 00:00:00.00' at 6211e0>
>>> age = - birthday
>>> print "Age in days", age.days
>>> print "Age in years", age.days / 365

I really can't quite fathom why you'd want to use something so low-level as
time.mktime... or just about anything in the time module :) If you want to
handle dates in a general way, I'd use one of the general-purpose date/time
handling libraries. They're far more capable and easier to use.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list