Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calc # of days between two dates

Status
Not open for further replies.

laina222

Technical User
Sep 7, 2001
172
US
I think this is simple, just never done it before.

I need to write a query that will calculate the number of days between two dates. Basically it'll be the number of days a contract was in effect. I have three fields - Contract#, DateIssued, DateExpired. I want to get the Contract# and the number of days it was in effect in my results.

Any ideas? Thanks in advance!
 
You may try something like this:
SELECT [Contract#], DateIssued, DateExpired, 1 + CLng(DateExpired - DateIssued) AS CountOfDays
FROM yourTable
WHERE DateExpired Is Not Null;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top