Borrar filtros
Borrar filtros

change julian date to format time

11 visualizaciones (últimos 30 días)
nada
nada el 3 de Jun. de 2018
Comentada: Star Strider el 3 de Jun. de 2018
Hi
How i can convert Julian date to formatOut = 'mmmm/dd/yyyy hh:mm:ss';
(719801.916666667) (719801.958333333) (719802)
  2 comentarios
Paolo
Paolo el 3 de Jun. de 2018
Are you sure the values you shared are in Julian date format and not datenum?
a = 719801.916666667;
The command:
datetime(a,'ConvertFrom','juliandate')
Outputs
25-Aug--2742 10:00:00
Whereas converting from datenum:
datetime(a,'ConvertFrom','datenum')
Outputs
30-Sep-1970 22:00:00
nada
nada el 3 de Jun. de 2018
thank you a lot but i have this error Undefined function 'datetime' for input arguments of type 'double'. my version ( 8.3.0.532 (R2014a) )

Iniciar sesión para comentar.

Respuesta aceptada

Star Strider
Star Strider el 3 de Jun. de 2018
I believe those are actually MATLAB datenum numbers. The years do not make sense using 'juliandate' or 'excel' with 'ConvertFrom'.
Try this:
dv = [719801.916666667
719801.958333333
719802];
dta = datetime(dv, 'ConvertFrom','datenum', 'Format','MMMM/dd/yyyy hh:MM:ss')
producing:
dta =
3×1 datetime array
September/30/1970 10:09:00
September/30/1970 10:09:59
October/01/1970 12:10:00
  2 comentarios
nada
nada el 3 de Jun. de 2018
thank you Star Strider
the same error i found Undefined function 'datetime' for input arguments of type 'double'. my version 8.3.0.532 (R2014a) how it can be work?
Star Strider
Star Strider el 3 de Jun. de 2018
The datetime functions were introduced in R2014b. Since your data appear to be MATLAB datenum numbers, you can use the datestr (link) function to create the strings. See specifically the formatOut (link) section. To use it, you would need to specify:
formatOut = 'mmmm/dd/yyyy HH:MM:SS';

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by