Standard way to express a date in a real number?

sdhyok sdhyok at yahoo.com
Thu Apr 17 04:02:09 CEST 2003


Jeffrey.S.Whitaker at noaa.gov wrote in message news:<Pine.OSX.4.53.0304161637310.801 at mac10.cdc.noaa.gov>...
> On Mon, 14 Apr 2003, sdhyok wrote:
> 
> The mx.DateTime module will do what you ask
> (http://www.egenix.com/files/python/mxDateTime.html).  For example, if you
> want hours since Jan 1 1900:
> 
> import mx.DateTime
> year = 1900
> month = 1
> day = 1
> hour = 0
> refdate = mx.DateTime.Date(year,month,day,hour)
> curdate = mx.DateTime.now()
> datediff = curdate - refdate
> print datediff.hours
> 
> 
> -Jeff
> 
>  --
> Jeffrey S. Whitaker         Phone : (303)497-6313
> NOAA/OAR/CDC  R/CDC1        FAX   : (303)497-6449
> 325 Broadway                Web   : http://www.cdc.noaa.gov/~jsw
> Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124

Thanks, Jeff. 
This is exactly what I sought.




More information about the Python-list mailing list