Epoch and Unix Timestamp Conversion in Visual Basic for Applications (VBA)
Visual Basic for Applications (VBA) is an implementation of Visual Basic 6 from Microsoft. It provides many date time functions to handle date time functionality.
Here we will explain Visual Basic for Applications (VBA) date time functions to get current epoch or Unix timestamp, convert timestamp to date and convert date to epoch or Unix timestamp.
Get current epoch or Unix timestamp in Visual Basic for Applications (VBA)You can get the current unix timestamp using DateDiff()
function like below.
DateDiff("s", "1/1/1970 00:00:00", Now())
Convert epoch or Unix timestamp to date in Visual Basic for Applications (VBA)
You can get the date from unix timestamp using DateAdd()
function like below.
DateAdd("s", 1745570040, "1/1/1970 00:00:00")
Convert date to epoch or unix timestamp in Visual Basic for Applications (VBA)
You can convert the date to unix timestamp using DateDiff()
function like below.
DateDiff("s", "1/1/1970 00:00:00", "2025-07-04")
More about date time in Basic for Applications (VBA)
Also, read:
- Epoch and Unix Timestamp Conversion in PHP
- Epoch and Unix Timestamp Conversion in Java
- Epoch and Unix Timestamp Conversion in JavaScript
- Epoch and Unix Timestamp Conversion in Perl
- Epoch and Unix Timestamp Conversion in Python
- Epoch and Unix Timestamp Conversion in TypeScript
- Epoch and Unix Timestamp Conversion in MySQL
- Epoch and Unix Timestamp Conversion SQL Server
- Epoch and Unix Timestamp Conversion in C# (C-Sharp)
- Epoch and Unix Timestamp Conversion in Kotlin
- Epoch and Unix Timestamp Conversion in Go
- Epoch and Unix Timestamp Conversion in Ruby
- Epoch and Unix Timestamp Conversion in MATLAB
- Epoch and Unix Timestamp Conversion in Rust