Created
May 19, 2018 18:31
-
-
Save RobBlackwell/913b129d8d91e72e9879b20cb38fd529 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MATLAB_EPOCH = Dates.DateTime(-0001,12,31) | |
""" | |
datenum(d::Dates.DateTime) | |
Converts a Julia DateTime to a MATLAB style DateNumber. | |
MATLAB represents time as DateNumber, a double precision floating | |
point number being the the number of days since January 0, 0000 | |
Example | |
datenum(now()) | |
""" | |
function datenum(d::Dates.DateTime) | |
Dates.value(d - MATLAB_EPOCH) /(1000 * 60 * 60 * 24) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment