📜  vba 日期到 unix 时间戳 - VBA 代码示例

📅  最后修改于: 2022-03-11 14:51:54.102000             🧑  作者: Mango

代码示例1
'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