Let
x=7.369030000162731e+05
x is a matlab date and it is equal to
27.07.2017 00:00:01.406
I want to remove the milliseconds from it (ie. .406)
To do this I convert it to datestr with 'dd.mm.yyyy HH:MM:SS' format and then again to datenum
datenum(datestr(x,'dd.mm.yyyy HH:MM:SS'))
Is there a simpler way to do this.
datenum
is expecting and the result is changed to from July 27, 2017 to January 1, 2017 (for me). One way to fix this is to explicitly pass the format string as a second parameter todatenum
like this:datenum(datestr(x,'dd.mm.yyyy HH:MM:SS'),'dd.mm.yyyy HH:MM:SS'))
. – informaton