The Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: rounding times
Replies: 1   Last Post: Nov 9, 2017 11:24 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Bruce Bowler

Posts: 301
Registered: 12/7/04
Re: rounding times
Posted: Nov 9, 2017 11:24 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Wed, 08 Nov 2017 16:23:26 -0600, dpb wrote:

> On 08-Nov-17 2:27 PM, Bruce Bowler wrote:
>> Any good tricks for rounding a serial date number to the nearest
>> minute?
>>
>> Obviously I could convert to a datevec, look at the seconds part, and
>> do some magic, but I can't believe there's not something better (for
>> various definitions of "better").

>
> Look at DATESHIFT() with the datetime object, the optional parameter
> rule,'nearest' should do what you're looking for (altho I've not ever
> used it other than with either the 'next' or 'previous' options
>
> dateshift(yourDateTimeArray,'start','minute','nearest')
>
> seems should work...


Sure does!

Thanks!



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.