mxDateTime package question
eddie at holyrood.ed.ac.uk
Wed Oct 13 12:27:53 CEST 2004
prashant_pai at yahoo.com (Prashant Pai) writes:
>I have a Julian (?) date string '2000238' (format YYYYDDD) which
>corresponds to 2000/08/25
>How do I create a correct DateTime object with this?
Logically you could do:
>>> import mx.DateTime
<DateTime object for '2000-08-25 00:00:00.00' at 403ae410>
However that doesn't work on all systems. Works on my Linux systems but not
my BSD ones :( Depends on the C implementation of strptime which has never
Probably better to do:
year,day = ...
mx.DateTime.strptime(year,'%Y') + int(day) - 1
<DateTime object for '2000-08-25 00:00:00.00' at 4039c138>
which is more portable.
More information about the Python-list