write a function that takes an input of seconds and returns it in days, hours, mins, and seconds as the output in matlab

main.m
function [days, hours, mins, secs] = convert_seconds(seconds)
    t = secondsToDate(seconds);
    days = t.Day - 1;
    hours = t.Hour;
    mins = t.Minute;
    secs = t.Second;
end

function t = secondsToDate(seconds)
    t = datetime(seconds,'ConvertFrom','s');
end
268 chars
12 lines

related categories

gistlibby LogSnag