We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,099 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Progress between two dates using current date

I am not sure how to accomplish this, but I am trying to take a dates from two fields and using the current date show the progress percentage in a different field.

So, if past date is Jan 1st, the current date is Jan 5th, the future date is Jan 10th. How do I get a percentage of completion between Jan 1st and Jan 10th based on today's date Jan 5th?

2
Contributors
1
Reply
25 Minutes
Discussion Span
3 Years Ago
Last Updated
2
Views
kalehl
Newbie Poster
5 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Try to work with numbers. And using DateDiff function.
Dates are numbers, so, it simplify your work! ;)


I will work with Jan 11th, only for rounding numbers, right?

Dim nDiasTotal as Integer, nDiasPassados as Integer

'GET DIFFERENCE BETWEEN JAN 1st AND JAN 11th
nDiasTotal = DateDiff("d", "01/01/2010", "11/01/2010")
'GET DIFFERENCE BETWEEN TODAY (ASSUMING TODAY IS JAN 6th) AND FIRST DATE
nDiasPassados = DateDiff("d", "01/01/2010", Date)

'CALCULATE PERCENTAGE OF PAST DAYS
MsgBox (nDiasPassados / nDiasTotal) * 100 & " % past time"
'CALCULATE PERCENTAGE OF REMAINING TIME
MsgBox 100 - ((nDiasPassados / nDiasTotal) * 100) & " % remaining time"

Hope it helps!

Sidnei

sidnei
Junior Poster in Training
55 posts since Dec 2009
Reputation Points: 22
Solved Threads: 10
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0558 seconds using 2.66MB