Converting Numeric Dates in Matlab does not work
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a date column in my table with dates in numeric format, e.g. one date might look like this: 738570
When I try to convert it like this:
table1.Date = date(table1.Date)
I get this error:
Error using date Too many input arguments
댓글 수: 2
Stephen23
2022년 3월 3일
The DATE function does not accept any input arguments:
What do you expect to happen when you call a function with more input arguments than it accepts?
채택된 답변
추가 답변 (1개)
Steven Lord
2022년 3월 3일
Another way to do this is to convery the serial date number to a datetime using the 'ConvertFrom' name-value pair argument.
x = 738570;
dt = datetime(x, 'ConvertFrom', 'datenum')
Let's check, since a datenum is the "Number of days since 0-Jan-0000 (proleptic ISO calendar)."
check = datetime(0, 1, 0) + caldays(x) % x calendar days after 0-Jan-0000
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Calendar에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!