excel date to unix timestamp

The solution for “excel date to unix timestamp” can be found here. The following code will assist you in solving the problem.

‘VBA functions to convert between Excel and Unix date-times.

‘These work on Windows and optionally the Mac:

Function UnixDateTime#(ExcelDateTime As Date, Optional Mac As Boolean)
Dim OSOffset: OSOffset = IIf(Mac, 24107, 25569)
UnixDateTime = (ExcelDateTime – OSOffset) * 86400
End Function

Function ExcelDateTime(UnixDateTime#, Optional Mac As Boolean) As Date
Dim OSOffset: OSOffset = IIf(Mac, 24107, 25569)
ExcelDateTime = (UnixDateTime / 86400) + OSOffset
End Function

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts