>>>>> "Jose" == Jose Gomez-Dans <[EMAIL PROTECTED]> writes:

    Jose> Hi!  We are tryint to access time data stored in an SQL The
    Jose> query returns a date object of type DbiDate. When printed,
    Jose> we get a nicely formatted text date. If cast into a float or
    Jose> int, you get the number of seconds elapsed since
    Jose> 1/1/1970. The way we are dealing with the conversion from
    Jose> this format into MPL format is:through time.strptime (using
    Jose> a format string), then converting that into a datetime
    Jose> object, and finally invoking MPL's date2num.

    Jose> Is there a better, quicker more obvious way to accomplish
    Jose> this?

Seconds since 1/1/1970 is often called "seconds since the epoch" and
mpl provides a conversion routine for dates in this form

  from matplotlib.dates import epoch2num

  e = int(mydate)  # convert your date to seconds since epoch
  d = epoch2num(e) # a mpl datenum

epoch2num also works over arrays or sequences of epochs.

JDH

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to