Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009
    Posts
    2

    Unanswered: Help! Calculate difference b/w Dates (auto-input today if Enddate=Null)

    Sorry for the novice question. I am trying to find a datediff() function that returns the amount of days between a startdate [SAC Join Date] and enddate [Drop Date], or would calculate the startdate and today if the enddate was blank, to a number field. I'm sure there is a pretty easy answer. I would try to have prettier code, but I'm totally lost and my newness for working with the datediff function is clearly showing. I've spend hours searching, and can't seem to find the answer. Thanks for the help.

    Dan

    =DateDiff("d",IIf(IsNull([Drop Date]), [SAC Join Date], Now()), [SAC Join Date], [Drop Date])+1

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    =DateDiff("d",[SAC Join Date],IIf(IsNull([Drop Date]),Now(),[Drop Date]))+1
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2009
    Posts
    2
    YOU ARE A FREEKING GENIUS!!! Hours of my pain and misery for minutes of your toying. It works perfectly! And with that, I'm spend.......(for now).

    Thanks Much,

    Dan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •