Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    266

    Unanswered: datediff (today - date)

    Hello

    I want to return the number of days between a date in the database and today

    something like
    Code:
    SELECT user.fName,
    user.lName & " (" & (datediff(now - user.lastVisit))  & " )" 
    FROM  user
    I must return

    John Turner (38)

    where 38 are the days between last visit and now

    thank you

  2. #2
    Join Date
    Nov 2005
    Location
    San Francisco, CA
    Posts
    506
    see this,now I think you can do it easily
    declare @datevar datetime
    select @datevar = getdate()


    *Example for datediff : getting no of days passed since 01-01-2006*/

    select datediff(dd,'20060101',@datevar) [No of days since 01-01-2006]
    Success is the ability to go from one failure to another with no loss of enthusiasm.
    - Sir Winston Churchill
    Joydeep

  3. #3
    Join Date
    Dec 2005
    Posts
    266
    it works !

    thanks a lot

Posting Permissions

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