| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
E = cdfepoch(date)
E = cdfepoch(date) converts the date, specified by date, into a cdfepoch object. date must be a valid date string, returned by datestr, or a serial date number, returned by datenum. date can also be a cdfepoch object.
When writing data to a CDF file using cdfwrite, use cdfepoch to convert MATLAB formatted dates to CDF formatted dates. The MATLAB cdfepoch object simulates the CDFEPOCH data type in CDF files.
To convert a cdfepoch object into a MATLAB serial date number, use the todatenum function.
The MATLAB serial date number calculates dates differently than CDF epochs.
A MATLAB serial date number represents the whole and fractional number of days from 1-Jan-0000 to a specific date. The year 0000 is merely a reference point and is not intended to be interpreted as a real year in time.
A CDF epoch is the number of milliseconds since 1-Jan-0000.
Convert the current time in serial date number format into a CDF epoch object.
% NOW function returns current time as serial date number
dateobj = cdfepoch(now)
dateobj =
cdfepoch object:
11-Mar-2009 15:09:25Convert the current time in date string format into a CDF epoch object.
% DATESTR function returns date as string
dateobj2 = cdfepoch(datestr(now))
dateobj2 =
cdfepoch object:
11-Mar-2009 15:09:25Convert the CDF epoch object into a serial date number.
dateobj = cdfepoch(now);
mydatenum = todatenum(dateobj)
mydatenum =
7.3384e+005
cdfinfo | cdfread | cdfwrite | datenum | datestr | todatenum
![]() | cdf2rdf | cdfinfo | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |