Calculate Time Interval/ Difference

버전 1.3.0.0 (8.44 KB) 작성자: Michael Chan
To compute time interval, taking into account leap days that are subsumed within that interval.
다운로드 수: 1.6K
업데이트 날짜: 2011/1/15

라이선스 보기

main executing reference usage: usage_timeDifference.m

Sample output:
The time interval between earierTime [09-Sep-1900 09:09:18] and laterTime [31-Oct-2010 23:33:08] is
110 years, 79 days, 14 hours, 23 mins, 50.17 secs.

The objective is to compute the time interval taking into account the leap days that are subsumed within the time interval.

Note:
The logic subsumes the time interval by
yearEnd, monthEnd, dayEnd - timeEarlier (within that year)
+ time interval (excluding that 2 years)
+ timeLater - yearEnd, monthEnd, dayEnd (within that year)

It differentiates the earlier time and later time, ie. timeDifference (earlierTime, laterTime) gives the same result as timeDifference (laterTime, earlierTime).

leapDayHasPassed.m illustrates a possible approach to determine if a certain day of concern is already over at a given time.

Caveat: does not include leap secs

If the reference demo has a more elegant presentation, please do not hesitate to suggest and send feedback to author.
Email: promethevx@yahoo.com.

Thank you.

Regards,
Michael Chan JT

인용 양식

Michael Chan (2024). Calculate Time Interval/ Difference (https://www.mathworks.com/matlabcentral/fileexchange/29194-calculate-time-interval-difference), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2010a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.3.0.0

Included Jan's rendition.

1.2.0.0

Improve time carry over (to be further refined)
Thank you, Ghee Leng for helping to test.

1.1.0.0

Retitled from "Calculate Time Interval" to "Calculate Time Interval/ Difference"

1.0.0.0