How to find out a date/time difference

Discussion in 'Python' started by Lad, May 24, 2006.

  1. Lad

    Lad Guest

    I use datetime class in my program and now
    I have two fields that have the datetime format like this
    datetime.datetime(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
    Lad, May 24, 2006
    #1
    1. Advertising

  2. Lad

    SaskMan Guest

    Convert datetime.datetime(2006, 5, 24, 16, 1, 26) to an ordinal number
    like:
    datetime.datetime(2006, 5, 24, 16, 1, 26).toordinal()
    and subtract them to get number of days.
    SaskMan, May 24, 2006
    #2
    1. Advertising

  3. Lad skrev:

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


    Did you try to subtract one value from the other?

    Mvh,

    --
    Klaus Alexander Seistrup
    SubZeroNet, Copenhagen, Denmark
    http://magnetic-ink.dk/
    Klaus Alexander Seistrup, May 24, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    1
    Views:
    594
    Matthew Speed
    Nov 8, 2003
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,243
    Michael Borgwardt
    May 30, 2004
  3. Drew
    Replies:
    5
    Views:
    16,289
    Roedy Green
    Jan 25, 2006
  4. Matt
    Replies:
    2
    Views:
    511
    Pete Becker
    Nov 8, 2003
  5. Nico Grubert
    Replies:
    2
    Views:
    330
    Klaus Alexander Seistrup
    May 24, 2006
Loading...

Share This Page