Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Comparison of time entries
Replies: 11   Last Post: Apr 25, 2012 1:33 PM

 Messages: [ Previous | Next ]
 dpb Posts: 9,850 Registered: 6/7/07
Re: Comparison of time entries
Posted: Apr 25, 2012 10:12 AM

On 4/25/2012 8:54 AM, dpb wrote:
...
> a) A datenum value for a time w/o a date will be a fractional portion of
> a day, not a value including a full number of days since the reference
> time, and

...

> >> start = datenum('14:32:41','hh:mm:ss')
> start =
> 0.6060

> >> endt = datenum('15:00:49','hh:mm:ss')
> endt =
> 0.6256

> >> endt-start
> ans =
> 0.0195

> >>
...

Oh, I overlooked something that may be the issue--the DATESTR formats
for time fields are documented as 'HH:MM:SS', not lowercased versions of
same. I couldn't find any definitive words about how they're
interpreted in the latest versions (not to say aren't there just I
didn't find it) but m, mm, etc., are month fields, not time minute fields.

In the older version here, it seems to cope as demonstrated; perhaps the
newer version is literally trying to do its best to comply and that's
where the mixup of days is coming from for a time field only.

Try

start = datenum('14:32:41','HH:MM:SS')
endt = datenum('15:00:49','HH:MM:SS')

and see if that doesn't bring joy...

--

Date Subject Author
4/24/12 Johannes
4/24/12 dpb
4/24/12 Steven Lord
4/25/12 Johannes
4/25/12 dpb
4/25/12 dpb
4/25/12 dpb
4/25/12 Barry Williams
4/25/12 Johannes
4/25/12 dpb
4/25/12 Barry Williams
4/25/12 Steven Lord