How to find out a date/time difference

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lad

    #1

    How to find out a date/time difference

    I use datetime class in my program and now
    I have two fields that have the datetime format like this
    datetime.dateti me(2006, 5, 24, 16, 1, 26)

    How can I find out the date/time difference ( in days) of such two
    fields?


    Thank you for help?
    L

  • SaskMan

    #2
    Re: How to find out a date/time difference

    Convert datetime.dateti me(2006, 5, 24, 16, 1, 26) to an ordinal number
    like:
    datetime.dateti me(2006, 5, 24, 16, 1, 26).toordinal()
    and subtract them to get number of days.

    Comment

    • Klaus Alexander Seistrup

      #3
      Re: How to find out a date/time difference

      Lad skrev:
      [color=blue]
      > How can I find out the date/time difference ( in days) of such
      > two fields?[/color]

      Did you try to subtract one value from the other?

      Mvh,

      --
      Klaus Alexander Seistrup
      SubZeroNet, Copenhagen, Denmark
      A small ActivityPub server for friends of Magnetic Ink.

      Comment

      Working...