datevec

  • [Year Month Day Hour Minutes Seconds] = datevec(X) returns from date numbers X the corresponding year, month, day, hour, minute and seconds
  • datevec(X,dateformat) uses date format specified in 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

> [year month day hour minute seconds] = datevec(736099.18)

	[year:2015]
	[month:5]
	[day:15]
	[hour:4]
	[minute:19]
	[seconds:12]
> datevec('15/05/2015','dd/mm/yyyy')#

	2015   5   15   0   0   0
> t = [today; today+15]

[t:2x1 double]

> [year month day hour minute seconds] = datevec(t)#

	2015	11	17	0	0	0
	2015	12	2	0	0	0

Resources

See also

datenum | datestr