主要内容

Dates and Time

Arrays of date and time values that can be displayed in different formats

日期和时间数据类型约会时间,duration, 和calendarDurationsupport efficient computations, comparisons, and formatted display of dates and times. Work with these arrays in the same way that you work with numeric arrays. You can add, subtract, sort, compare, concatenate, and plot date and time values. You also can represent dates and times as numeric arrays or as text. For more information, seeRepresent Dates and Times in MATLABor watch日期和时间阵列.

fonctions

développer tout

Points in Time

约会时间 代表时间点的数组
末日 Shift date or generate sequence of dates and times
NaT 不是一次
eomday 一个月的最后一天
lweekdate Date of last occurrence of weekday in month
nweekdate Date of specific occurrence of weekday in month

持续时间

一年s 多年的持续时间
天s Duration in days
小时s 数小时的持续时间
分钟 Duration in minutes
第二s Duration in seconds
milliseconds 毫秒的持续时间
duration 固定长度单位的时间长度

Calendar Durations

calyears Calendar duration in years
cal Calendar duration in quarters
加尔姆斯 Calendar duration in months
卡维克斯 日历持续时间
Caldays Calendar duration in days
calendarDuration 可变长度日历单元中的时间长度

一个月日历

calendar 指定月日历

以替代格式的时间点

日期num Convert date and time to serial date number
now Current date and time as serial date number
Current date and time as date vector
日期 Current date as character vector
今天 (Not recommended; useDateTime(“今日”)) Current date
eomdate (Not recommended; use末日)一个月的最后日期

提取组件

一年 Year number of input date and time
quarter Quarter number of input date and time
month 输入日期和时间的月号或名称
星期 Week number of input date and time
投入日期和时间的日期或名称
星期天 Day of week
小时 Hour component of input date and time
分钟 Minute component of input date and time
第二 Seconds component of input date and time
星期num (Not recommended; use星期) Week in year

Split into Components

ymd DateTime的年,月和日数
hms Hour, minute, and second numbers of datetime or duration
日期vec 将日期和时间转换为组件的向量
分裂 Split calendar duration into numeric and duration units
time Convert time of calendar duration to duration
timeofday Elapsed time since midnight for约会时间数组

约会时间Arrays

between Calendar math differences
caldiff 日历数学连续差异
tzoffset UTC的时区偏移
末日 Shift date or generate sequence of dates and times

固定格式阵列

addtodate Modify date number by field
Etime Time elapsed between date vectors
月份 (Not recommended; usebetween)日期之间的整个月数
isbetween 在日期和时间间隔内确定元素
是规则 Determine if input times are regular with respect to time or calendar unit
isnat Determine NaT (Not-a-Time) elements
ISDST Determine daylight saving time elements
isweekend 确定周末d elements
iSdateTime 确定输入是否为dateTime数组
isduration 确定输入是否为持续时间数组
iscalendarduration Determine if input is calendar duration array
string String array
char 字符阵列
Datest Convert date and time to string format

转换

convertTo Convert约会时间价值s to numeric representations
exceltime ConvertMATLAB约会时间toExcel日期number
posixtime ConvertMATLAB约会时间toPOSIXtime
朱利安达特 ConvertMATLAB约会时间to Julian date
Yyyymmdd ConvertMATLAB约会时间to YYYYMMDD numeric value
m2xdate (Not recommended; useexceltime)MATLAB日期toExcel序列日期编号
x2mdate (Not recommended; use约会时间)Excel序列日期编号MATLAB序列日期编号or约会时间价值

Times inMATLAB

timezones List time zones
跳力 List all leap seconds supported by约会时间数据类型
matlab.datetime.compatibility.convertDateNum 将输入转换为约会时间价值s in a backward-compatible way

rubriques

résolutiondesproblèmes

Carryover in Date Vectors and Strings

如果元素不超出传统范围,则MATLAB调整了该日期向量元素和上一个元素。

Converting Date Vector Returns Unexpected Output

由于日期向量是数字的1 x-6向量,因此Datest可能会将您的输入日期向量解释为串行日期编号的向量,或将序列日期编号解释为日期向量,并返回意外的输出。