How to readjust a timestamp?

Kofi Agyemang Amankwah · Jul 24, 2023 · 1.9K views
Question
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
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Aug 25, 2026
"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.)

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!