datestr function Unrecognized month format error

2 visualizaciones (últimos 30 días)
Yusuf Suer Erdem
Yusuf Suer Erdem el 12 de Jul. de 2021
Comentada: Yusuf Suer Erdem el 15 de Jul. de 2021
Hello :) could you help me with that error below?
"Error using matlab.internal.datetime.cnv2icudf (line 99) Unrecognized month format. Format: mmmmm dd, yyyy HH:MM:SS.FFF AM."
Those are my codes;
clc; clear; close all;
monday=datestr(now,'mmmmm dd, yyyy HH:MM:SS.FFF AM')

Respuesta aceptada

Walter Roberson
Walter Roberson el 12 de Jul. de 2021
you have 5 m for the month field but datestr only permits up to 4 m

Más respuestas (1)

Seth Furman
Seth Furman el 14 de Jul. de 2021
We highly recommend using datetime in place of datestr, now, datenum, etc.
You can get a datetime version of the same value using datetime('now') and convert it to a text representation using the string function.
e.g.
dt = datetime('now','Format','MMMM dd, yyyy hh:mm:ss.SSS a')
dt = datetime
July 14, 2021 05:07:08.084 PM
txt = string(dt)
txt = "July 14, 2021 05:07:08.084 PM"

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by