Skip to content

datevec

Convert a date to a 6-element date vector.

V = datevec(N)
V = datevec(S, format)

Returns [year month day hour minute second] from a serial date number N or a date string S. The inverse of now/clock format conversions.

datevec(now) % [2026 4 28 13 25 51.123]
datevec('2026-04-28', 'yyyy-mm-dd')
  • datestr — Format a date as a string.
  • now — Current date and time as a serial date-time number.
  • clock — Current date and time as a 6-element vector.