Timestamp Converter
Convert between Unix timestamps and human-readable dates
Current Timestamp
🕐 Timestamp to Date
Unix timestamp (seconds or milliseconds)
Enter a timestamp above
📅 Date to Timestamp
Select a date above
Get Current Timestamp in Different Languages
JavaScript
// Get current timestamp in seconds
const timestamp = Math.floor(Date.now() / 1000);
// Get current timestamp in milliseconds
const timestampMs = Date.now();
Python
import time
import datetime
# Get current timestamp
timestamp = int(time.time())
# Using datetime
timestamp = int(datetime.datetime.now().timestamp())
PHP
<?php
// Get current timestamp
$timestamp = time();
// Using DateTime
$timestamp = (new DateTime())->getTimestamp();
?>
Java
// Get current timestamp in seconds
long timestamp = System.currentTimeMillis() / 1000;
// Using Instant
long timestamp = Instant.now().getEpochSecond();
C#
// Get current timestamp
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
// Using DateTime
long timestamp = ((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds();
Go
package main
import (
"time"
)
// Get current timestamp
timestamp := time.Now().Unix()
// Get timestamp in milliseconds
timestampMs := time.Now().UnixMilli()
Ruby
# Get current timestamp
timestamp = Time.now.to_i
# Using DateTime
timestamp = DateTime.now.to_time.to_i
Rust
use std::time::{SystemTime, UNIX_EPOCH};
// Get current timestamp
let timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs();
About Unix Timestamps
A Unix timestamp is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC. It's a widely used standard for representing time in computer systems.
- Seconds: Standard Unix timestamp (10 digits)
- Milliseconds: JavaScript timestamp (13 digits)
- UTC: All timestamps are in Coordinated Universal Time