Datetime 'convertfrom' forcing dates to be Jan2019
Afficher commentaires plus anciens
Hi there,
I'm trying to convert my data's date format from MM/dd/yyyy to dd/MM/yyyy.
I'm using;
load conductortemps17sept19_4 %datafile
T = conductortemps17sept194;
T.Properties.VariableNames = {'Datapoint' 'LogDate' 'LogTime' 'Broken' 'Uncoated' 'Solvent' 'Water' 'MV01' 'MV06'};
T(1,:) = []; %Remove headings from data
T.LogDate = datetime(T.LogDate, 'ConvertFrom', 'MM/dd/yyyy', 'Format','dd/MM/yyyy'); %convert to british dates
T.LogDate.Format = 'HH:mm:ss dd/MM/yyyy';
T.LogTime.Format = 'HH:mm:ss dd/MM/yyyy';
T.Time = T.LogDate + timeofday(T.LogTime); %combine date and time
The 'Logdate' data ranges 17th September to 1st October (today). However it's converting all dates to be Jan2019.
This code has been working fine for the past few weeks, giving correct dates. What am I doing wrong?
The attachments are the loaded file and the output I'm seeing for dates.
Kind regards,
Oliver
2 commentaires
Stephen23
le 1 Oct 2019
Your uploaded table does not contain the variable/column LogDate, so we have no way to know how your code relates to your uploaded data, if at all (it would throw an error).
Oliver Higbee
le 2 Oct 2019
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Calendar dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


