Clearly the epoch base was chosen as 0001-01-01T00:00:00 rather than 0000-01-01T00:00:00 as stated in the stdlib manual.
I would have raised an issue about this had I been able to figure out how to do so - being very new on github. Nevertheless I certainly would not have expected conversion and back conversion to have been off by a full year!
‘’’
As Julia Date and DateTime values are represented according to the ISO 8601 standard, 0000-01-01T00:00:00 was chosen as base (or “rounding epoch”) from which to begin the count of days (and milliseconds) used in rounding calculations. (Note that this differs slightly from Julia’s internal representation of Date s using Rata Die notation; but since the ISO 8601 standard is most visible to the end user, 0000-01-01T00:00:00 was chosen as the rounding epoch instead of the 0000-12-31T00:00:00 used internally to minimize confusion.)
‘’’
Even if what I got actually is intended behaviour, I still feel there should be a function that back converts a datetime value to its original state. In my code, I’ve used the simple expedient of subtracting Dates.value(DateTime(0)) from the datetime value to be converted before calling the Dates.epochms2datetime function. However using different epoch and internal rounding values certainly does not minimize confusion!
On the assumption this is actually intended behaviour and not a bug, the documentation definitely needs to be updated to clarify the usage of function Dates.epochms2datetime.
My workaround is to subtract Dates.value(DateTime(0)) from my date time values before backconversion.