To get epoch time in MATLAB, you can use the posixtime
function from the datetime
class.
Here's an example:
main.m39 chars2 lines
This will return the current epoch time in seconds. You can convert it to milliseconds by multiplying it by 1000.
main.m43 chars2 lines
Alternatively, you can also use the posixtime
function with a specific input time.
main.m74 chars2 lines
In this case, the input time is January 1st, 2022 at 00:00:00 UTC.
gistlibby LogSnag