views:

245

answers:

3

How can I get seconds since epoch (1/1/1970) in VBA?

+1  A: 

Here's a solution: http://vbcity.com/forums/t/5084.aspx

RC
+3  A: 

How about:

datediff("s",#1970/1/1#,now())
Remou
A: 

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
Oorang