If you are trying to do it on the device, I think you may be able to use the millis() function to do this task. It gives the number of miliseconds since startup. If you want to do it in MATLAB, now will give you the present time that you can save, and then use datetime to manipulate the dates.