Code covered by the BSD License  

Highlights from
Round off dates and times

4.0

4.0 | 1 rating Rate this file 15 Downloads (last 30 days) File Size: 5.99 KB File ID: #26374

Round off dates and times

by Kevin J. Delaney

 

13 Jan 2010 (Updated 03 May 2010)

Rounds off a datenum to the nearest second, minute, hour, day, month or year.

| Watch this File

File Information
Description

Rounds off a datenum to the nearest second, minute, hour, day, month or year. Zip file includes "units.m" (file 4093) by Henning Ressing.

Example: datenum_round_off(now, 'minute')

Acknowledgements

Units.M inspired this file.

MATLAB release MATLAB 7.9 (R2009b)
Tags for This File  
Everyone's Tags
date, datenum, round, time
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
26 Jun 2012 Andrea

Nice one, thanks. You can add the possibility of rounding down, up or scientifically by changing the final "round" with floor, ceil or leave it to round (and possibly make the user decide with an argument to the function)

Updates
03 May 2010

Fixed H1 comment line so "lookfor" will work.

Contact us