How can I get seconds since epoch (1/1/1970) in VBA?
How about:
datediff("s",#1970/1/1#,now())
This should run faster than the DateDiff solution:
Private Function Long2Date(lngDate As Long) As Date
Long2Date = lngDate / 86400# + #1/1/1970#
End Function
Private Function Date2Long(dtmDate As Date) As Long
Date2Long = (dtmDate - #1/1/1970#) * 86400
End Function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With