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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date subtraction

Status
Not open for further replies.

Krash878

Programmer
May 8, 2001
172
US
Can a Date be subtracted from another date?

I have to keep track of how many days we are working on something and then bill accordingly. The billing fomula is

Rate= 6/365
Rate X Amnt X Actual Days

So if I have an item that was $100.00
And I recieved it on 06/14/01 and finished it on 06/26/01

6/365 X $100.00 X 12 = $19.72

Can dates be subtracted to give me a number

Thanks
Kenny
 
Yes.

Use dateDiff

to get the number of days use:

dim i as integer

i = datediff("d",startdate,enddate)

Nick
 
You can also do just a regular subtraction of the dates by doing the following:

#1/3/01/#-#1/1/01#

That would result in 2.

HTH Joe Miller
joe.miller@flotech.net
 
DateDif worked I was using it in a query
Thanks
Kenny
 
Arg I forgot a question
The Formula
Rate= 6/365
Rate X Amnt X Actual Days

I have the days part how do I multiply the feilds in the query or on a form

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top