## Round Dates and Times

versión 1.6.5 (8.04 KB) por
Round dates/times to the selected unit (round/floor/ceiling).

1,2K descargas

Ver licencia

This function rounds datetime or serial date numbers or date vectors to the nearest year, month, day, hour, minute, or second. With a choice of rounding, floor, or ceiling.

### Examples ###

Examples use the date+time described by the vector [1999,1,3,15,6,48.0568].

datevec(dateround(730123.62972287962))
ans = [1999,1,3,15,6,48]

datevec(dateround([1999,1,3,15,6,48.0568]))
ans = [1999,1,3,15,6,48]

datevec(dateround([1999,1,3,15,6,48.0568],'minute'))
ans = [1999,1,3,15,7,0]

datevec(dateround([1999,1,3,15,6,48.0568],5)) % 5=='minute'
ans = [1999,1,3,15,7,0]

datevec(dateround([1999,1,3,15,6,48.0568],5,'floor'))
ans = [1999,1,3,15,6,0]

datevec(dateround([1999,12,31,23,59,59.5000;1999,12,31,23,59,59.4999]))
ans = [2000,1,1,0,0,0;1999,12,31,23,59,59]

### Citar como

Stephen23 (2022). Round Dates and Times (https://www.mathworks.com/matlabcentral/fileexchange/39274-round-dates-and-times), MATLAB Central File Exchange. Recuperado .

##### Compatibilidad con la versión de MATLAB
Se creó con R2010b
Compatible con cualquier versión