cdfepoch
(Not recommended) Convert date text or serial date number to CDF formatted dates
cdfepoch
is not recommended. Use
the cdflib
low-level functions instead. (since R2023b) For more
information on updating your code, see Version
History.
Syntax
E = cdfepoch(date)
Description
E = cdfepoch(date)
converts the specified
date to a cdfepoch
object. date
must be a valid
date value represented by text, as returned by datestr
, or a
serial date number, returned by datenum
.
date
can also be a cdfepoch
object. The
MATLAB®
cdfepoch
object simulates the CDF_EPOCH
data type
in CDF files.
Examples
Convert the current time in serial date number format to a
cdfepoch
object.
% NOW function returns current time as serial date number dateobj = cdfepoch(now) dateobj = cdfepoch object: 11-Mar-2009 15:09:25
Convert the current time, which is returned by datestr
in
text form, to a cdfepoch
object.
% DATESTR function returns text representing a date dateobj2 = cdfepoch(datestr(now)) dateobj2 = cdfepoch object: 11-Mar-2009 15:09:25
Convert the cdfepoch
object to a serial date number.
dateobj = cdfepoch(now); mydatenum = todatenum(dateobj) mydatenum = 7.3384e+005