By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,997 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,997 IT Pros & Developers. It's quick & easy.

Calculate Average Date

P: n/a
Hi all

How would I find out the average date when given a bunch of dates? For
example, I want to find the average length in time from the following dates:
----------------------------------------------------
Start Date End Date
01/01/2004 12:50pm 02/01/2004 18:40pm
02/01/2004 13:40pm 02/01/2004 13:57pm
02/01/2004 14:30pm 02/01/2004 19:50pm

Min = 17 Minutes (2nd entry)
Max = 1 Day 5 Hours 10 Minutes (1st entry)
Average = ??
-----------------------------------------------------
Also, I have a function that calculates the time difference between 2 dates,
but it doesn't work all that well if you take int account months, does
anyone have a good function that can take 2 date parameters and return the
time difference formatted as '? Months ? Days ? Minutes ? Hours ? Seconds'

Thanks for your help,

Kind Regards,
Steve.

Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
maybe you can convert all datetimes to ticks (Ticks property on datetime
object = Long)
with that its very easy to make differences, compare values and calculate an
average
you can pass the resulting Long (=ticks) to the contructor of a new datetime
object...
hope this helps

dominique


"Steve" <stevea@centurion-ms_RemoveThis_.co.uk> wrote in message
news:eL**************@TK2MSFTNGP10.phx.gbl...
Hi all

How would I find out the average date when given a bunch of dates? For
example, I want to find the average length in time from the following dates: ----------------------------------------------------
Start Date End Date
01/01/2004 12:50pm 02/01/2004 18:40pm
02/01/2004 13:40pm 02/01/2004 13:57pm
02/01/2004 14:30pm 02/01/2004 19:50pm

Min = 17 Minutes (2nd entry)
Max = 1 Day 5 Hours 10 Minutes (1st entry)
Average = ??
-----------------------------------------------------
Also, I have a function that calculates the time difference between 2 dates, but it doesn't work all that well if you take int account months, does
anyone have a good function that can take 2 date parameters and return the
time difference formatted as '? Months ? Days ? Minutes ? Hours ? Seconds'

Thanks for your help,

Kind Regards,
Steve.

Nov 20 '05 #2

P: n/a
Cor
Hi Dominiwue,

Any advantage with the databox, because it was you, I took even more time
than normal for you to investigate it in a lot of posibilities, so I am
curious of the result?

Cor
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.