有没有办法在MATLAB中将time = 08/10/2014 23:34:02
转换为Epoch秒(数字数组)?
答案 0 :(得分:5)
所以你想要Unix标准,可以按如下方式计算:
InputDate=datenum('20141008 233402','yyyymmdd HHMMSS');
UnixOrigin=datenum('19700101 000000','yyyymmdd HHMMSS');
EpochSecond=round((InputDate-UnixOrigin)*86400);
>> 1412811242
编辑OP的日期格式:
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