hms
Split datetime or duration values into hour, minute, and second components.
📝Syntax
[h, m, s] = hms(t)
📥Input Arguments
Parameter Description
inputs datetime, duration, serial date number, or date-compatible input.
📤Output Arguments
Parameter Description
output Three double arrays containing hour, minute, and second values.
📄Description

Split datetime or duration values into hour, minute, and second components.

For duration input, the hour part may exceed 23 because it represents elapsed hours. For datetime input, the hour part is the time-of-day hour.

Array-valued inputs keep their data shape when the operation supports arrays. Scalar operands are expanded where the implementation defines scalar expansion.

💡Examples
Basic usage.
[h, m, s] = hms(duration(27, 5, 6))
[h, m, s] = hms(datetime(2024, 5, 17, 13, 14, 15))
🔗See Also
datetimeduration
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub