Excel VBA: How to convert date string "2012-08-20" to timestamp: 1345438800 I need to store 1345438800 in cell as long data type value.
Date to timestamp:
Public Function toUnix(dt) As Long toUnix = DateDiff("s", "1/1/1970", dt) End Function
Timestamp to date:
Public Function fromUnix(ts) As Date fromUnix = DateAdd("s", ts, "1/1/1970") End Function
1.4m articles
1.4m replys
5 comments
57.0k users