Date and time formate translation
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I need to translate those dates and time (strings)
'25-Mar-2014 13:00:00'
'07-Nov-2018 18:30:45'
to the forllowing format (in string as well):
'2014-03-25T13:00:00.000Z'
'2018-11-07T18:30:45.000Z'
Any idea how to handle such kind of formats? I find it pretty complex...
2 Commenti
Risposta accettata
dpb
il 1 Dic 2018
Modificato: dpb
il 1 Dic 2018
dt=datetime('25-Mar-2014 13:00:00');
fmt= 'uuuu-MMM-dd''T''HH:mm:ss.SSS''Z';
dt.Format=fmt;
>> dt =
datetime
2014-Mar-25T13:00:00.000Z
>>
3 Commenti
dpb
il 1 Dic 2018
Yes. datestr is a remnant of the deprecated datenum that didn't have a formatting option; it is just a particularly-scaled double.
char(dt) is the idiom if need the character array; for most purposes however, either cellstr or string is probably more useful/less coding downstream--but depends upon just why you actually need the string representation at all...
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Dates and Time in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!