Duration precision in subtracting two datetimes

조회 수: 3 (최근 30일)
Andrea Sbaragli
Andrea Sbaragli 2021년 5월 24일
편집: Adam Danz 2021년 5월 24일
In subtracting two datetimes I lost what comes after the seconds. In particular
A(1,1) = '05-Mar-2021 13:01:53.917194495'
B(1,1) = '05-Mar-2021 11:41:36.619605504'
why C= A{1,1} - B{1,1} = 01:20:17??

채택된 답변

Adam Danz
Adam Danz 2021년 5월 24일
편집: Adam Danz 2021년 5월 24일
Set the display format to include up to 9 fractional second digits
A = datetime('05-Mar-2021 13:01:53.917194495');
B = datetime('05-Mar-2021 11:41:36.619605504');
C = A-B;
C.Format = 'hh:mm:ss.SSSSSS'
C = duration
01:20:17.297588

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by