cancel
Showing results for 
Search instead for 
Did you mean: 

midpoint of two times over 24 hours

0 Kudos
107

I'm trying to write a report that will give me the midpoint between two datetime fields. How can this be done?

Example #1:

if the first datetime field is 04/10/02 09:00:00AM and second is 04/10/02 10:00:00AM, then I want the midpoint to be 04/10/02 09:30:00AM

Example #2:

if the first datetime field is 04/09/02 11:00:00PM and second is 04/10/02 03:00:00AM, then I want the midpoint to be 04/10/02 01:00:00AM

Thanks in advance!

Accepted Solutions (0)

Answers (1)

Answers (1)

DellSC
Active Contributor
0 Kudos

First you'll find the difference in seconds between the two datetimes and then you'll add half of that amount to the earlier datetime. It might look like this:

NumberVar secDiff := DateDiff('s', {first time}, {second time}) / 2;
DateAdd('s', Round(secDiff, 0), {firstTime})

-Dell