-
-
Save seumasmorrison/12d54bce761152cdf5b6 to your computer and use it in GitHub Desktop.
Function for converting from matlab datenum to Python datetime
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
from datetime import datetime, timedelta | |
matlab_datenum = 731965.04835648148 | |
def matlab_to_python_datetime(matlab_datenum): | |
return datetime.fromordinal(int(matlab_datenum)) + timedelta(days=matlab_datenum%1) - timedelta(days = 366) | |
matlab_to_python_datetime(matlab_datenum) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment