Difference between two dates in Weeks and Days

D

David

Hi,

I have an order processing system in which I have an OrderDate and a
Completion Date

I want to print the difference in Weeks and Days between the two dates,
i.e. if the completion date is 3 weeks and 2 days after the order date,
I want to print : 3 Weeks and 2 Days, on the page.
Is this possible ?

Appreciate your help


Thanks
David
 
E

Evertjan.

David wrote on 28 jun 2006 in microsoft.public.inetserver.asp.general:
I have an order processing system in which I have an OrderDate and a
Completion Date

I want to print the difference in Weeks and Days between the two dates,
i.e. if the completion date is 3 weeks and 2 days after the order date,
I want to print : 3 Weeks and 2 Days, on the page.
Is this possible ?

Yes.


dif = DateDiff( "d", date1, date2 )

weeks = fix( dif / 7 )

restDays = abs( dif - ( weeks * 7 ) )

result = weeks & " weeks and " & restDays & " days."

[not tested]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top