Hi all,
I am trying to read some data collected. I made a mistake and inputted 07/24/2023 instead of 07/23/2023. Now the matlab date which is in a number format is unable to correctiy read the data based on these timestamps.
Please, I will apprciate it if any one can help me adjust the matlab date 07/23/2023 to 07/24/2023 or any suggestions will be appreciated.
NOTE: the malab date is in a number format eg. 7.390905000610648e+05

 채택된 답변

Voss
Voss 2023년 7월 23일
편집: Voss 2023년 7월 23일

0 개 추천

"the malab date is in a number format eg. 7.390905000610648e+05"
The number format is the number of days since Jan 0, 0000 (see: datenum), e.g.:
datenum('07/23/2023')
ans = 739090
datenum('07/24/2023')
ans = 739091
"help me adjust the matlab date 07/23/2023 to 07/24/2023"
In order to adjust the date forward by one day (e.g., from 07/23/2023 to 07/24/2023), you can add 1 to the number.
num = 739090.5000610648;
datetime(num,'ConvertFrom','datenum')
ans = datetime
23-Jul-2023 12:00:05
num = num+1;
datetime(num,'ConvertFrom','datenum')
ans = datetime
24-Jul-2023 12:00:05
(If you want to go from 07/24/2023 to 07/23/2023, you would subtract 1. Your question says you want to do both.)

추가 답변 (0개)

카테고리

도움말 센터File 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