datestring shows incorrect answers

2 views (last 30 days)
navan on 1 Jun 2016
Edited: navan on 2 Jun 2016
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
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 ?

Accepted Answer

Thorsten on 2 Jun 2016
Edited: Thorsten on 2 Jun 2016
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 Comment
navan on 2 Jun 2016
Edited: navan on 2 Jun 2016
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 :)

Sign in to comment.

More Answers (0)


Find more on Data Type Conversion in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!