year
Returns the year of a given date string, s.
Syntax
R = year(s)
R = year(s, fmt)
Inputs
- s
- A string representing a date. By default, if no fmt is specified, s is expected to be in the format dd-mmm-yyyy.
- fmt (optional)
- Returns the given format that s is in. Valid formats that can
return year are:
- 'dd-mmm-yyyy HH:MM:SS'
- 'dd-mmm-yyyy'
- 'mm/dd/yy'
- 'yyyy'
- 'yy'
- 'mmmyy'
- 'QQ-YY'
- 'dd/mm/yy'
- 'mmm.dd,yyyy HH:MM:SS'
- 'mmm.dd,yyyy'
- 'mm/dd/yyyy'
- 'dd/mm/yyyy'
- 'yy/mm/dd'
- 'yyyy/mm/dd'
- 'QQ-YYYY'
- 'mmmyyyy'
- 'yyyy-mm-dd'
- 'yyyymmddTHHMMSS'
- 'yyyy-mm-dd HH:MM:SS'
Outputs
- R
- Year from the given date s
Examples:
R = year('10-Apr-2019')
R = 2019
R = year('Apr.04,2019 10:11:12', 'mmm.dd,yyyy HH:MM:SS')
R = 2019