MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

t.Month = [1,2,3]


t = 1x3 datetime array
13-Jan-2014 23:12:56 14-Feb-2014 19:12:56 15-Mar-2014 15:12:56


Set the time zone of t by assigning a value to the TimeZone property.


t.TimeZone = 'Europe/Berlin';


Change the display format of t to display only the date, and not the time information.


t.Format = 'dd-MMM-yyyy'


t = 1x3 datetime array
13-Jan-2014 14-Feb-2014 15-Mar-2014


If you assign values to a datetime component that are outside the conventional range,
MATLAB® normalizes the components. The conventional range for day of month numbers
is from 1 to 31. Assign day values that exceed this range.


t.Day = [-1 1 32]


t = 1x3 datetime array
30-Dec-2013 01-Feb-2014 01-Apr-2014


The month and year numbers adjust so that all values remain within the conventional
range for each date component. In this case, January -1, 2014 converts to December 30,
2013.


See Also


datetime | hms | week | ymd


See Also
Free download pdf