another time challenge

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nephish@xit.net

    #1

    another time challenge

    Hey there pythoneers

    i have another question about time, specifically, the mxDateTime
    module.
    i have been able to get a RelativeDateTim eDiff between two times,
    it gives me a difference between two DateTimes in the form of +3days
    +2hours etc...

    so, if i have a date that is 6 days and 6 hours from another day,
    it will give me Days+6, hours+5.

    what i need is something like 6.4 days or close to it.
    is there an easy way to convert this ?

    if not i can write up something to do the math.

    i guess i am just looking for a cleaner shortcut.

    thanks

  • Eddie Corns

    #2
    Re: another time challenge

    nephish@xit.net writes:
    [color=blue]
    >Hey there pythoneers[/color]
    [color=blue]
    >i have another question about time, specifically, the mxDateTime
    >module.
    >i have been able to get a RelativeDateTim eDiff between two times,
    >it gives me a difference between two DateTimes in the form of +3days
    >+2hours etc...[/color]
    [color=blue]
    >so, if i have a date that is 6 days and 6 hours from another day,
    >it will give me Days+6, hours+5.[/color]
    [color=blue]
    >what i need is something like 6.4 days or close to it.
    >is there an easy way to convert this ?[/color]
    [color=blue]
    >if not i can write up something to do the math.[/color]
    [color=blue]
    >i guess i am just looking for a cleaner shortcut.[/color]

    You could extract the hours,mins,secs part to a DateTimeDelta which supports
    float() and just divide that into 86400.0.

    Eddie

    Comment

    • nephish@xit.net

      #3
      Re: another time challenge

      cool, thanks
      -shawn

      Comment

      Working...