convert date to number
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi,
I want to convert this : 00:01:36.480
HH:MM:SS.fff where f is a millisecond
into this number 000136480
is it possible?
my version of matlab R2019b
thank you
댓글 수: 3
답변 (1개)
Star Strider
2020년 3월 15일
편집: Star Strider
2020년 3월 15일
This appears to do what you want:
This = '00:01:36.480';
NowThis = datetime(This, 'InputFormat','HH:mm:ss.SSS', 'Format','HHmmssSSS')
producing:
NowThis =
datetime
000136480
EDIT — (15 Mar 2020 at 14:51)
To get a character array output:
This = '00:01:36.480';
NowThis = string(datetime(This, 'InputFormat','HH:mm:ss.SSS', 'Format','HHmmssSSS'))
ThisStr = sscanf(NowThis, '%s')
producing:
ThisStr =
'000136480'
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!