• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 516
  • Last Modified:

Calculating No of days passed from getdate()

Hi,

I am using MSSQL 2005

I want no of days passed from the given date for example

If getdate() = 6 Nov

and pastDate = '2008-10-03 00:00:00.000'

Then I want no of days passed in integer

I am writting below query which is giving me date. But I want integer value, which tell no of days passed

select getDate()- CONVERT(datetime, '2008-10-03 00:00:00.000')

Thanks in Advance
0
tia_kamakshi
Asked:
tia_kamakshi
2 Solutions
 
Chandan_GowdaCommented:
select datediff(dd,'2008-10-03',getdate())
0
 
BinuthCommented:
try this
declare @dt as datetime
set @dt = cast('2008-10-03 00:00:00.000' as datetime)
 
select ABS(datediff(day,@dt,getDate()))

Open in new window

0
 
tia_kamakshiAuthor Commented:
Many Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now