Epoch and Unix Timestamp Conversion in TypeScript
TypeScript is a is an open-source programming langauge. It builds on JavaScript with the goal for the development of large applications and transcompiles to JavaScript. In TypeScript, the Date()
object represents a date and time functionality.
Here we will explain TypeScript 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 TypeScriptYou can get the current timestamp using Date()
object and getTime()
in TypeScript like below:
new Date().getTime()
Convert epoch or Unix timestamp to date in TypeScript
You can also convert unix timestamp to date using Date()
object in TypeScript like below:
let unixTimestamp = 1745573453;
let formattedDate = new Date(unixTimestamp * 1000);
Convert date to epoch or unix timestamp in TypeScript
You can convert date to unix timestamp using Date()
object and getTime()
function TypeScript.
(new Date("2025-07-04")).getTime();
More about date time in TypeScript
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 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 VBA
- Epoch and Unix Timestamp Conversion in MATLAB
- Epoch and Unix Timestamp Conversion in Rust