How do I convert a date to unix-format

S

Soren

Hi

I need a VBA function to convert a date (e.g. 06-28-2004)
to UNIX-format (e.g. 1088433541)

Can anyone help me?

Thanks
Soren
 
J

Jonathan West

Soren said:
Hi

I need a VBA function to convert a date (e.g. 06-28-2004)
to UNIX-format (e.g. 1088433541)

Can anyone help me?

The Unix date format is the number of seconds since 1/1/1970. On that basis,
this should give you the correct value

Function UnixDate(d As Date) As Long
UnixDate = DateDiff("s", #1/1/1970#, d)
End Function
 
Top