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
More Related Contents:
- Autofilter with column formatted as date
- Changing the date format to yyyy-mm-dd
- Convert month name into number
- How to color all the rows based on the cell values
- Excel – opening file stuck on 100%, until VBA code finishes
- Using a UDF in Excel to update the worksheet
- VBA check if file exists
- Excel’s fullname property with OneDrive
- How to insert an embedded picture?
- How to call a macro from a button and pass arguments
- Copy Excel range as Picture to Outlook
- Obtain attribute names from XML using VBA
- Paste Excel range in Outlook
- Return RGB values from Range.Interior.Color (or any other Color Property)
- VBa conditional delete loop not working
- Translate text using vba
- Run-time error ‘1004’ : Method ‘Range’ of object’_Global’ failed
- “Can’t find Project or Library” for standard VBA functions
- How do I issue an HTTP GET from Excel VBA for Mac
- Update excel sheet based on outlook mail [closed]
- Copy sheet and get resulting sheet object?
- In Excel, can I use a hyperlink to run vba macro?
- Select Newest Record and Create New Table of Unique Values in Excel
- Are ActiveX Controls Disabled?
- Excel Date Conversion from yyyymmdd to mm/dd/yyyy
- Best way to protect Excel VBA code? [closed]
- VBA copy rows that meet criteria to another sheet
- VBA Dialog box to select range in different workbook
- Function Overloading and UDF in Excel VBA
- VBA Excel simple Error Handling