Clear Filters
Clear Filters

change julian date to format time

15 views (last 30 days)
Hi
How i can convert Julian date to formatOut = 'mmmm/dd/yyyy hh:mm:ss';
(719801.916666667) (719801.958333333) (719802)
  2 Comments
Paolo
Paolo on 3 Jun 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 on 3 Jun 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) )

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 3 Jun 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 Comments
nada
nada on 3 Jun 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 on 3 Jun 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';

Sign in to comment.

More Answers (0)

Categories

Find more on Dates and Time in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!