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

date reformatting minus to getdate

I have data in a table with the following format.
8/27/2007 12:00:00 AM
My job is to figure out how many days it has been since that day to the current day.  Any ideas?  usually I would just do a getdate()- whatever.  But that is not working as the date is in timestamp form.  And I need it in # of days.  
0
casit
Asked:
casit
3 Solutions
 
dportasCommented:
Is your date column a DATETIME or SMALLDATETIME? Assuming it is, use the DATEDIFF function:
http://msdn2.microsoft.com/en-us/library/ms189794.aspx
0
 
dbbishopCommented:
SELECT DATEDIFF(d, myDate, GETDATE())
0
 
appariCommented:
try

select datediff(dd, yourtimestampcolumn, getdate())
from yourtable
0
 
casitAuthor Commented:
well all three of you are right so I will split the points.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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