month

month returns the month from a given date.
  • month(str) returns from date string str the corresponding month assuming that date format is 'mm/dd/yyyy'
  • month(str,dateformat) month(str,dateformat) uses the date format specified in the second parameter. Available formats:
    • 'yyyy/mm/dd'
    • 'yyyy-mm-dd'
    • 'mm/dd/yyyy'
    • 'mm-dd-yyyy'
    • 'dd/mm/yyyy'
    • 'dd-mm-yyyy'
    • 'dd/mmm/yyyy'

Examples

>> month('12/02/2015')

[ans:12]

>> month({'2015,05,15'; '2014, 01, 24'}, 'yyyy,mm,dd')#

            5
            1

See also

datenum | datevec | year