Main Content

todatenum

(Not recommended) Convert CDF epoch object to MATLAB serial date number

todatenum is not recommended. Use cdfread instead. (since R2023b) For more information on updating your code, see Version History.

Syntax

n = todatenum(ep_obj)

Description

n = todatenum(ep_obj) converts the cdfepoch object ep_obj to a MATLAB® serial date number. A CDF epoch is the number of milliseconds since 01-Jan-0000, while a MATLAB datenum value is the number of days since 00-Jan-0000.

Examples

Construct a cdfepoch object from text that represents a date. Then, convert the object back to its original form.

dstr = datestr(today)
dstr =
   08-Oct-2003

obj = cdfepoch(dstr)
obj =
     cdfepoch object:
     08-Oct-2003 00:00:00

dstr2 = datestr(todatenum(obj))
dstr2 =
   08-Oct-2003

Version History

Introduced before R2006a

collapse all