How many days between two dates

Discussion in 'Questions (Windows Mobile)' started by pmu5757, Sep 20, 2007.

  1. pmu5757

    pmu5757 Member Licensed User

    Hello !

    I'm trying to find how many days are between two dates (the first one is now, and the second one is in a table).

    I've build this :
    Int((Now - DateParse (Tftabledonnees.Cell("Date",3)))/10000000/60/60/24)

    It seems to work when the two dates are in the same month, but it doesn't work othewise.
    It would be fine if someone could help me... and if everybody in this forum could excuse me for my poor english.
    Thank you.

  2. Rioven

    Rioven Active Member Licensed User

    Hi, your code will get (-)negative value for future date, (+)positive value for past date. it works ok.
    Just make sure of a given date, which is in a correct 'dateFormat' in using 'dateParse' statement.

    ex. "9/21/2007", this should be "09/21/2007"
  3. alfcen

    alfcen Well-Known Member Licensed User

    Hello Pascal,
    You may wish to replace
    with the constant

    You can get rid of negative values with

    No apologies needed for your English :sign0142:

  4. pmu5757

    pmu5757 Member Licensed User


    With your answers, I've found the solution.
    Some dates that I used had not the right format (01/01/2007 instead of 01/01/07)
    It works well now.
    I also use now the constant "cTicksPerDay"

    Thank you ! :sign0098:

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice