Current Unix Timestamp SECONDS SINCE JAN 01 1970

Current UTC Time
2025-08-20
Convert Unix Timestamp to Datetime in VBScript

How to convert Unix timestamp to Datetime in VBScript

🎈 🎈 🎈
+1

    Dim unixTimestamp
    Dim dateObj
    
    unixTimestamp = 1484262421
    dateObj = DateAdd("s", unixTimestamp, "01/01/1970 00:00:00")
    
    WScript.Echo "Converted Date: " & dateObj            
        

Output:
Converted Date: 2017-01-12 23:07:01
Example only. There may be multiple ways to perform this operation.

Code Explanation

In this VBScript example, the Unix timestamp 1484262421 is added to the Unix epoch start date ("01/01/1970 00:00:00") using the DateAdd function.
The "s" parameter in DateAdd indicates that we are adding seconds. The result is stored in dateObj, which represents the date and time corresponding to the Unix timestamp. The script then outputs this date and time as 2017-01-12 23:07:01 .



Other useful VBScript date functions

Function Description Example
Now() Returns the current date and time. Now() returns 2024-08-28 12:34:56
Date() Returns the current date. Date() returns 2024-08-28
Time() Returns the current time. Time() returns 12:34:56
DateAdd() Adds a specified time interval to a date. DateAdd("d", 10, "2024-08-28") returns 2024-09-07
DateDiff() Returns the difference between two dates in a specified interval (e.g., seconds, days, months). DateDiff("d", "2024-08-28", "2024-09-07") returns 10
DatePart() Returns a specific part of a given date (e.g., year, month, day). DatePart("m", "2024-08-28") returns 8
DateSerial() Returns a date for the specified year, month, and day. DateSerial(2024, 8, 28) returns 2024-08-28
TimeSerial() Returns a time for the specified hour, minute, and second. TimeSerial(12, 34, 56) returns 12:34:56
Year() Returns the year of a specified date. Year("2024-08-28") returns 2024
Month() Returns the month of a specified date. Month("2024-08-28") returns 8
Day() Returns the day of the month of a specified date. Day("2024-08-28") returns 28
Weekday() Returns the day of the week for a specified date. Weekday("2024-08-28") returns 4 (Wednesday)
Current Unix Timestamp SECONDS SINCE JAN 01 1970

Current UTC Time
2025-08-20
Ad Banner Placeholder
Ad Banner Placeholder
Ad Banner Placeholder
Ad Banner Placeholder