Linux Timestamp to Date — Free Converter for Linux

Linux stores file times, log entries, and system events as Unix timestamps — integers counting seconds since January 1, 1970 UTC. This page shows every practical way to convert a linux timestamp to date using built-in command-line tools, plus an interactive converter you can use right now.

How Linux Handles Timestamps

Every file on a Linux filesystem carries three timestamps stored in its inode:

  • mtime — modification time: when the file content was last written
  • atime — access time: when the file was last read or executed
  • ctime — change time: when the inode metadata (permissions, owner, link count) last changed

At the kernel level these are stored as struct timespec — a pair of values: tv_sec (seconds since epoch) and tv_nsec (nanoseconds within that second). Modern Linux filesystems like ext4 and btrfs support nanosecond precision.

The stat command reads all three timestamps from the inode and prints them in a human-readable format. You can also retrieve them as raw epoch integers using format strings.

Current Unix Timestamp

1776195270

Free — No Limits, No Signup

Convert

or

Results

UTC Time
Local Time
ISO 8601
Relative Time
Unix (seconds)
Unix (milliseconds)
Day of Week
Day of Year
Week Number
Is DST

Convert Timestamp to Date on Linux Command Line

Six battle-tested one-liners, from the simplest to the most flexible:

1. GNU date -d @ (simplest)

# Convert epoch seconds to local date/time
date -d @1700000000
# → Tue Nov 14 22:13:20 UTC 2023

# Convert to a custom format
date -d @1700000000 '+%Y-%m-%d %H:%M:%S'
# → 2023-11-14 22:13:20

2. date -r (file modification time)

# Print the mtime of a file as a readable date (GNU date)
date -r /etc/passwd
# → Mon Jan  1 00:00:00 UTC 2024

# Or pass an epoch integer directly (same as -d @ on GNU date)
date -r 1700000000

3. stat -c (epoch from file metadata)

# Get mtime of a file as epoch seconds
stat -c %Y /etc/passwd
# → 1704067200

# Chain with date to convert immediately
date -d @$(stat -c %Y /etc/passwd) '+%Y-%m-%d %H:%M:%S'
# → 2024-01-01 00:00:00

4. awk strftime (batch conversion)

# Convert epoch column in a CSV/log file
echo "1700000000" | awk '{print strftime("%Y-%m-%d %H:%M:%S", $1)}'
# → 2023-11-14 22:13:20

# Convert multiple timestamps from a file (one per line)
awk '{print strftime("%Y-%m-%dT%H:%M:%SZ", $1)}' timestamps.txt

5. perl localtime

# Convert epoch to local time string
perl -e 'print scalar localtime(1700000000), "
"'
# → Tue Nov 14 22:13:20 2023

# Convert epoch to UTC ISO 8601
perl -MPOSIX -e 'print strftime("%Y-%m-%dT%H:%M:%SZ", gmtime(1700000000)), "
"'
# → 2023-11-14T22:13:20Z

6. python3 datetime

# Convert epoch to UTC datetime object
python3 -c "import datetime; print(datetime.datetime.utcfromtimestamp(1700000000))"
# → 2023-11-14 22:13:20

# ISO 8601 with timezone
python3 -c "from datetime import datetime, timezone; print(datetime.fromtimestamp(1700000000, tz=timezone.utc).isoformat())"
# → 2023-11-14T22:13:20+00:00

Get Current Timestamp on Linux

Three ways to get the current Unix timestamp in the shell:

date +%s (portable, spawns subprocess)

date +%s
# → 1700000000

printf in Bash (no subprocess)

# Bash 4.2+ built-in — faster in tight loops
printf '%(%s)T
' -1
# → 1700000000

/proc/uptime (seconds since boot, not epoch)

# First field is seconds since last boot — NOT epoch time
cat /proc/uptime
# → 12345.67 23456.78

# Calculate boot time from uptime and current epoch
echo $(($(date +%s) - ${SECONDS}))

Linux Timestamp in Log Files

Different logging subsystems on Linux store timestamps in different formats:

journalctl — systemd journal

# Display entries with Unix timestamp prefix
journalctl -o short-unix

# Filter by human-readable time range
journalctl --since "2024-01-01" --until "2024-01-02"

# Show raw microsecond timestamps
journalctl -o export | grep __REALTIME_TIMESTAMP

dmesg — kernel ring buffer

# Timestamps shown are seconds since boot (NOT epoch)
dmesg
# → [    0.000000] Initializing cgroup subsys cpuset

# Show human-readable timestamps (requires --ctime or -T flag)
dmesg -T
# → [Mon Jan  1 00:00:00 2024] Initializing cgroup subsys cpuset

auth.log / syslog — traditional format

# Traditional syslog format uses MMM DD HH:MM:SS (no year, no epoch)
tail /var/log/auth.log
# → Jan  1 00:00:00 hostname sshd[1234]: ...

# Parse with awk and date to get epoch
awk '{print $1, $2, $3}' /var/log/auth.log |   while read m d t; do date -d "$m $d $t" +%s; done

journalctl --since with epoch

# Filter journal entries after a specific epoch timestamp
journalctl --since "@1700000000"
# The @ prefix tells journalctl to interpret as Unix timestamp

Frequently Asked Questions

How do I convert a Linux timestamp to a date?

Use the GNU date command: date -d @TIMESTAMP. For example, date -d @1700000000 outputs Tue Nov 14 22:13:20 UTC 2023. For custom formats, add a format string: date -d @1700000000 '+%Y-%m-%d'.

What are mtime, atime, and ctime in Linux?

mtime (modification time) is when the file content was last changed. atime (access time) is when the file was last read. ctime (change time) is when the file metadata — permissions, owner — was last changed. All three are stored as Unix timestamps in the inode.

How do I get the current Unix timestamp on Linux?

Run date +%s in the terminal. In Bash scripts you can also use printf '%(%s)T\n' -1 which avoids spawning a child process and is faster in tight loops.

What is struct timespec on Linux?

struct timespec is a C structure with two fields: tv_sec (seconds since epoch) and tv_nsec (nanoseconds). It is used by clock_gettime() and file stat calls to represent sub-second precision timestamps.

How do I read timestamps in Linux log files?

systemd journals store timestamps as microseconds since epoch. Use journalctl -o short-unix to display them as raw Unix timestamps, or journalctl --since '2024-01-01' to filter by human-readable date. The dmesg command shows seconds since boot, not since epoch — use dmesg -T for wall-clock timestamps.

How do I convert a file modification time to a date on Linux?

Use stat filename to see all three timestamps in human-readable form. To get just the mtime as epoch seconds, run stat -c %Y filename. To convert it immediately: date -d @$(stat -c %Y filename).

Related Tools