在MATLAB中有没有一种方法可以将时间=08/10/2014 23:34:02转换成纪元秒(数字数组)?

最佳答案

因此,您需要Unix标准,其计算方法如下:

InputDate=datenum('20141008 233402','yyyymmdd HHMMSS');
UnixOrigin=datenum('19700101 000000','yyyymmdd HHMMSS');

EpochSecond=round((InputDate-UnixOrigin)*86400);

>> 1412811242

编辑操作的日期格式:
MYSTRING = '08/10/2014 23:34:02';
InputDate = datenum(MYSTRING,'dd/mm/yyyy HH:MM:SS');
UnixOrigin=datenum('19700101 000000','yyyymmdd HHMMSS'); %//This can stay the same, unless you want to change it for consistency.
EpochSecond=round((InputDate-UnixOrigin)*86400);

>>1412811242

09-07 18:38