Date Diff problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?UGV0ZXIgTmV3bWFu?=

    Date Diff problem

    Can anybody assist me in fixing this code to return the number of days
    idfference

    DateDiff("d", Date.Now, CDate(FILEMOVED ATE))

    FILEMOVEDATE = '05/07/2007'

    i was expecting a return of 2 but get a return of 1 instead, any suggstions.
  • Joergen Bech

    #2
    Re: Date Diff problem


    No problems. That is the correct value.

    Maybe the code below might ring a few bells:

    ---snip---
    Dim dnow As Date = Date.Now
    Dim dfuture As New Date(2007, 7, 5)

    Dim span As TimeSpan = dfuture.Subtrac t(dnow)

    MsgBox(span.Day s.ToString)
    MsgBox(span.Hou rs.ToString)
    MsgBox(span.Min utes.ToString)

    MsgBox(span.Tot alDays.ToString ("0.00"))
    MsgBox(span.Tot alHours.ToStrin g("0.00"))
    MsgBox(span.Tot alMinutes.ToStr ing("0.00"))
    ---snip---

    Regards,

    Joergen Bech



    On Tue, 3 Jul 2007 01:42:01 -0700, Peter Newman
    <PeterNewman@di scussions.micro soft.comwrote:
    >Can anybody assist me in fixing this code to return the number of days
    >idfference
    >
    DateDiff("d", Date.Now, CDate(FILEMOVED ATE))
    >
    >FILEMOVEDATE = '05/07/2007'
    >
    >i was expecting a return of 2 but get a return of 1 instead, any suggstions.

    Comment

    Working...