[Tutor] datenum

Gregor Lingl glingl at aon.at
Fri Sep 26 11:01:18 EDT 2003


Hi, Cliff!
There is a powerful *new* datetime-module in Python 2.3 
Its documented here (and in the Global Module Index):

http://www.python.org/doc/current/lib/module-datetime.html

Maybe the toordinal method of the date class is something you could use:

 >>> from datetime import date
 >>> date(2003,9,25).toordinal()
731483

(Maybe you will need anoter "some zero" ?)

Have a look at the docu. You cerainly will find something which
at least will make your life easier.

Regards, Gregor

Cliff Martin schrieb:

> Hi,
>
> There is a function in MatLab called DATENUM which converts a date (in 
> M D Y format) to a number referenced to some zero.  Is there such a 
> function already written in Python or one of its modules?  I'm porting 
> a MatLab program and would like not to have to write this function 
> from scratch, if possible.  Thanks
>
> Cliff
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>




More information about the Tutor mailing list