- Регистрация
- 1 Мар 2015
- Сообщения
- 1,481
- Баллы
- 155
If you’ve seen numbers like 1746959680 in your code or logs and wondered what on earth is this? — welcome to the world of Unix timestamps.
In this quick guide, you’ll learn:
A Unix timestamp (or Epoch time) is the number of seconds that have passed since:
? January 1st, 1970 at 00:00:00 UTC
This moment is known as the Unix Epoch — a standard starting point for time in computing systems.
For example:
1746959680 → May 11, 2025, 10:54:40 AM UTC
Unix time is widely used because it’s:
Unix timestamps are everywhere for good reasons:
? Easy comparisons — Just subtract two timestamps to get time differences
? Lightweight storage — Numbers instead of long date strings
? Universal format — Used in APIs, databases, logs, and analytics
? How to Convert a Unix Timestamp
Use a Free Online Converter
Don’t want to write code? No problem. Paste your timestamp into a tool like:
? )
Features:
Here’s how to convert a Unix timestamp in Python:
import datetime
timestamp = 1746959680
dt = datetime.datetime.utcfromtimestamp(timestamp)
print(dt.strftime('%Y-%m-%d %H:%M:%S'))
# Output: 2025-05-11 10:54:40
? Want to skip the code?
? Convert in Node.js
Node.js uses the same Date object as browser JavaScript, so it’s just as simple:
const timestamp = 1746959680;
const date = new Date(timestamp * 1000);
console.log(date.toISOString());
// Output: 2025-05-11T10:54:40.000Z
If you want local time instead:
console.log(date.toLocaleString());
// Output depends on your system’s locale and timezone
? Pro Tip: Use libraries like dayjs, luxon, or moment for more robust time formatting in Node.js apps.
? Want to skip the code?
? Convert in JavaScript
JavaScript works with milliseconds, so multiply by 1000:
const timestamp = 1746959680;
const date = new Date(timestamp * 1000);
console.log(date.toISOString());
// Output: 2025-05-11T10:54:40.000Z
? Note: Always remember JS uses milliseconds, not seconds.
? Want to skip the code?
Convert in Java
In Java, use the Instant and ZonedDateTime classes from the java.time package (Java 8+):
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
public class UnixTimestampConverter {
public static void main(String[] args) {
long timestamp = 1746959680L;
Instant instant = Instant.ofEpochSecond(timestamp);
ZonedDateTime dateTime = instant.atZone(ZoneId.of("UTC"));
String formatted = dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
System.out.println(formatted);
// Output: 2025-05-11 10:54:40
}
}
This prints the UTC time from the Unix timestamp. You can also adjust the ZoneId for local time.
? Want to skip the code?
? Bonus: Real-World Uses
You’ll find Unix timestamps in:
? Google Analytics events
?️ Backend logs and crash reports
?️ Databases like PostgreSQL and MongoDB
? Bookmark or Share
If this helped you understand Unix timestamps better:
Bookmark this page for later
? Share it with your dev team
? Explore more tools at unixtimestamp-converter.com
Happy coding! ?
In this quick guide, you’ll learn:
What a Unix timestamp is- ? How to convert it to a human-readable format
- ? Code examples in Python, JavaScript, Java & Node.js
A free tool for instant conversion →
A Unix timestamp (or Epoch time) is the number of seconds that have passed since:
? January 1st, 1970 at 00:00:00 UTC
This moment is known as the Unix Epoch — a standard starting point for time in computing systems.
For example:
1746959680 → May 11, 2025, 10:54:40 AM UTC
Unix time is widely used because it’s:
- Language-agnostic
- Compact
- Efficient for calculations and comparisons
Unix timestamps are everywhere for good reasons:
? Easy comparisons — Just subtract two timestamps to get time differences
? Lightweight storage — Numbers instead of long date strings
? Universal format — Used in APIs, databases, logs, and analytics
? How to Convert a Unix Timestamp
Don’t want to write code? No problem. Paste your timestamp into a tool like:
? )
Features:
- Convert timestamps to UTC/local time
- Convert both seconds and milliseconds
- Convert from date to timestamp, and vice versa
Here’s how to convert a Unix timestamp in Python:
import datetime
timestamp = 1746959680
dt = datetime.datetime.utcfromtimestamp(timestamp)
print(dt.strftime('%Y-%m-%d %H:%M:%S'))
# Output: 2025-05-11 10:54:40
? Want to skip the code?
? Convert in Node.js
Node.js uses the same Date object as browser JavaScript, so it’s just as simple:
const timestamp = 1746959680;
const date = new Date(timestamp * 1000);
console.log(date.toISOString());
// Output: 2025-05-11T10:54:40.000Z
If you want local time instead:
console.log(date.toLocaleString());
// Output depends on your system’s locale and timezone
? Pro Tip: Use libraries like dayjs, luxon, or moment for more robust time formatting in Node.js apps.
? Want to skip the code?
? Convert in JavaScript
JavaScript works with milliseconds, so multiply by 1000:
const timestamp = 1746959680;
const date = new Date(timestamp * 1000);
console.log(date.toISOString());
// Output: 2025-05-11T10:54:40.000Z
? Note: Always remember JS uses milliseconds, not seconds.
? Want to skip the code?
In Java, use the Instant and ZonedDateTime classes from the java.time package (Java 8+):
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
public class UnixTimestampConverter {
public static void main(String[] args) {
long timestamp = 1746959680L;
Instant instant = Instant.ofEpochSecond(timestamp);
ZonedDateTime dateTime = instant.atZone(ZoneId.of("UTC"));
String formatted = dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
System.out.println(formatted);
// Output: 2025-05-11 10:54:40
}
}
This prints the UTC time from the Unix timestamp. You can also adjust the ZoneId for local time.
? Want to skip the code?
? Bonus: Real-World Uses
You’ll find Unix timestamps in:
? Google Analytics events
?️ Backend logs and crash reports
?️ Databases like PostgreSQL and MongoDB
? Bookmark or Share
If this helped you understand Unix timestamps better:
? Share it with your dev team
? Explore more tools at unixtimestamp-converter.com
Happy coding! ?