datestring shows incorrect answers

2 ビュー (過去 30 日間)
navan
navan 2016 年 6 月 1 日
編集済み: navan 2016 年 6 月 2 日
I have taken a specific date from Igor pro and import it into matlab. the corresponding integer value of the time '1/1/2016 00:00:00.058 'when i upload the file from igor pro into matlab was '3534468465.15625'. When i try to use the date string function
t=3534468465.15625;
string=datestr(t);
the output is coming as '22-Dec-7045 03:45:00'. But the required answer was '1/1/2016 00:00:00.058'. Can some one please help why this error is happening ?

採用された回答

Thorsten
Thorsten 2016 年 6 月 2 日
編集済み: Thorsten 2016 年 6 月 2 日
Igor Pro uses the seconds since 1904-01-01. So you can convert it using
dv = datevec(3534468465.15625/(3600*24) + datenum(1904, 1, 1, 0, 0, 0))
Which gives ans =
2016.00 1.00 1.00 4.00 47.00 45.16
This gives the correct year, month and day, but the time is still wrong.
Are you 100% sure that the correct time is '1/1/2016 00:00:00.058 ' and not '1/1/2016 04:47:45.16'?
  1 件のコメント
navan
navan 2016 年 6 月 2 日
編集済み: navan 2016 年 6 月 2 日
Dear Thorsten, Thanks a lot for that great help. You are exactly right. Mine output was wrong. The Answer you were getting was the right one and the required answer. thanks again for your valuable time and helping me :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by