See the datestr reference page to find valid string values for F. MATLAB considers date string years that are specified with only two characters (e.g., '79') to fall within 100 years of the current year. datenum returns a column vector of m date numbers, where m is the total number of date strings in S. All date strings in S must have the same format, and that format must match one of the date string formats shown in the help for the datestr function. Input S can be a one-dimensional character array or cell array of date strings. datenum returns a column vector of m date numbers, where m is the total number of date vectors in V.Ĭonverts one or more date strings S to serial date numbers N using format string F to interpret each date string. Each element of V must be a positive double-precision number. A partial date vector has three elements, specifying year, month, and day, in that order.
CONVERTING SERIAL DATE NUMBER TO DATE FORMAT MATLAB FULL
A full date vector has six elements, specifying year, month, day, hour, minute, and second, in that order. Input V can be an m-by-6 or m-by-3 matrix containing m full or partial date vectors respectively. The year 0000 is merely a reference point and is not intended to be interpreted as a real year in time.Ĭonverts one or more date vectors V to serial date numbers N. Here is an example of a date and time expressed in the three MATLAB formats:Ī serial date number represents the whole and fractional number of days from to a specific date.
"West" 06:12 254.09 9.Datenum (MATLAB Functions) MATLAB Function ReferenceĬonvert date and time to serial date numberĭatenum is one of three conversion functions that enable you to express dates and times in any of three formats in MATLAB: a string (or date string), a vector of date and time components (or date vector), or as a numeric offset from a known date in time (or serial date number). Region OutageTime Loss Customers RestorationTime Cause OutageDuration
For example, you can calculate the durations of the power outages and attach them to the table as a duration array. "NorthEast" 05:54 0 0 NaT "equipment fault"Īs these table variables are datetime arrays, you can perform convenient calculations with them. Region OutageTime Loss Customers RestorationTime Cause