Skip to content

Instantly share code, notes, and snippets.

@Godisemo
Created February 22, 2019 12:50
Show Gist options
  • Save Godisemo/a4cb267055753d494350e2f357ac6ef6 to your computer and use it in GitHub Desktop.
Save Godisemo/a4cb267055753d494350e2f357ac6ef6 to your computer and use it in GitHub Desktop.
Matlab date conversion in Julia
const MATLAB_EPOCH = Dates.DateTime(-1,12,31)
date2num(d::Dates.DateTime) = Dates.value(d-MATLAB_EPOCH)/(1000*60*60*24)
num2date(n::Number) = MATLAB_EPOCH + Dates.Millisecond(round(Int64, n*1000*60*60*24))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment