Loading the converter. If this message stays, JavaScript is blocked on this page (see the setup notes).

Current epoch time (seconds)
0
Microseconds: 0
UTC: –

UTC is the default. It matches what most Linux logs use.

Epoch or date, one box

Type a number to read it as a timestamp. Type a date such as 2023-11-14 22:13:20 to get the epoch value. Add Z or an offset like +05:00 to override the zone.

Linux source decoder

Pick where the value came from. The tool applies the right unit and the right starting point.

Linux log scanner

Paste lines from journalctl exports, audit.log, dmesg, or /etc/shadow. Each known time field gets a readable date in brackets. Remove password hashes first. They are not needed here.

Add time and compare timestamps

Set an expiry, or find the gap between two events. Leave the start empty to use the current time.

Year 2038 check for your setup

Pick a Linux setup to see the last second it can store, and the command that checks it.

Every conversion runs in your browser. Nothing you type is sent to a server. For a quick check of a single value, you can also use the online epoch converter at timestampconverter.app.

Linux Timestamp Converter: Decode Epoch Time in journald, auditd and dmesg

Linux does not keep time in one format. The journal stores microseconds, the audit log adds a serial number, dmesg counts seconds since boot, and /etc/shadow counts days. A basic epoch tool cannot tell these apart. This Linux timestamp converter reads each format as you type and writes the matching command. For a normal epoch value, run date -u -d @1700000000. For the current time, run date +%s. The sections below explain every source and its traps.

Where Linux Stores Time

A Unix timestamp is the number of seconds since 00:00:00 UTC on January 1, 1970. Many Linux tools use that idea but change the unit or the starting point. The table shows the formats you meet most often on a Linux system.

Source Unit and starting point Example
date +%s Seconds since 1970 1700000000
journald __REALTIME_TIMESTAMP Microseconds since 1970 1700000000123456
journalctl -o short-unix Seconds with a microsecond fraction 1700000000.123456
audit.log msg=audit() Seconds and milliseconds, then a colon and an event serial audit(1700000000.123:456)
dmesg raw output Seconds since boot [ 3600.500000]
/proc/stat line btime Seconds since 1970, the moment of boot btime 1700000000
/proc/uptime Seconds since boot, including time in suspend 5089.43
/proc/PID/stat field 22 Clock ticks since boot 137911
/etc/shadow date fields Days since 1970 19675

How to Use This Linux Timestamp Converter

  1. For a plain epoch value or a date, use the one box at the top. The result and the commands update as you type.
  2. For a value from a specific log, open the Linux source decoder and pick the source. It handles the unit for you.
  3. For dmesg lines and process start times, enter the boot time. Run awk '/^btime/{print $2}' /proc/stat on the same machine and paste the result.
  4. For many lines at once, paste them into the Linux log scanner. Lines with known fields get a date after the value.
  5. For a future expiry, use the add time tool. It prints both the date and the epoch value.
  6. Copy any command with the Copy button and run it on your server to confirm the result.

Convert Epoch Time With systemd Tools

Most current Linux distributions ship systemd, and it has its own time parser. The command systemd-analyze timestamp accepts an epoch value that starts with an at sign. It prints the date in local time, then in UTC, then the Unix seconds again.

systemd-analyze timestamp @1700000000
  Original form: @1700000000
Normalized form: Tue 2023-11-14 22:13:20 UTC
   UNIX seconds: @1700000000
       From now: 3 years 0 months ago

The same at sign works in journalctl. This is the cleanest way to read the journal around a moment you only know as an epoch value. The example below shows one minute of log lines.

journalctl --since @1700000000 --until @1700000060

I ran both commands on systemd 257. Check your version with systemd-analyze --version if a command fails on an older system.

Read journald Timestamps

Each journal entry carries two clocks. The field __REALTIME_TIMESTAMP is a Unix time in microseconds. The field __MONOTONIC_TIMESTAMP counts microseconds since boot. When you export the journal as JSON, you see both. Divide the real time value by 1,000,000 to get seconds.

date -u -d @1700000000.123456 '+%F %T.%6N'
2023-11-14 22:13:20.123456

To see this number without exporting, ask for the Unix output mode.

journalctl -o short-unix -n 3

That mode prints seconds with a microsecond fraction at the start of each line. You can pass the value straight to date -d @.

Read auditd Timestamps

Audit records show the time inside the msg field. The format is seconds, a dot, milliseconds, a colon, and an event serial number. Red Hat’s guide uses this sample line.

type=SYSCALL msg=audit(1364481363.243:24287): arch=c000003e syscall=2

The time is 1364481363.243, which is 2013-03-28 14:36:03.243 UTC. The number after the colon, 24287, is not part of the time. It links the lines that belong to one event. Records of the same event share the same time and serial. To pull the time out of a line, use grep -o 'audit([0-9.]*' and remove the prefix.

Convert dmesg Boot Time to a Real Date

Raw dmesg output shows seconds since boot, not a date. The kernel ring buffer does not store a wall clock time for each message. To get a date, add the number to the boot time. Linux keeps the boot moment as an epoch value in /proc/stat, on the line that starts with btime.

awk '/^btime/{print $2}' /proc/stat
1700000000

With a boot time of 1700000000, the line [ 3600.500000] happened 3,600.5 seconds later. That is 23:13:20.5 UTC on November 14, 2023. You can paste both numbers into the decoder above to check this.

You may know the option dmesg -T. The dmesg manual warns that its timestamps can be wrong. The clock it uses does not advance during suspend, so after a suspend and resume the dates can drift. A system that has been suspended many times can show times that are far off. For wall clock times, a common fix is journalctl -k, which shows kernel messages from the journal.

Decode Password Aging Days in /etc/shadow

The file /etc/shadow does not store seconds. The third field is the date of the last password change, counted in days since January 1, 1970. The account expiration field also uses days. A value of 19675 means November 14, 2023.

date -u -d '1970-01-01 +19675 days' +%F
2023-11-14

To go the other way, turn a date into seconds and divide by 86,400.

echo $(( $(date -u -d '2023-11-14' +%s) / 86400 ))
19675

A value of 0 in the last change field has a special meaning. It tells the system that the user must set a new password at the next login. On a live system, root can run chage -l username to see these dates in readable form.

Find and Set File Times With touch and find

GNU touch accepts an epoch value with an at sign. It sets the access and modification times to that moment. It does not set the change time, because the kernel sets that one itself.

touch -d @1700000000 report.txt
stat -c '%Y %y' report.txt
1700000000 2023-11-14 22:13:20.000000000 +0000

The same at sign form works in find. This lists files changed after a given moment.

find /var/log -newermt @1700000000

Use ls -l --time-style=+%s when you want the epoch value in a directory listing.

Add Time Without Breaking Daylight Saving

There are two ways to add a day. You can add 86,400 seconds, or you can ask date for one calendar day later. These give different results on the day a time zone changes its clock.

export TZ=America/New_York
date -d '2023-03-11 12:00' +%s
date -d '2023-03-11 12:00 1 day' +%s

On March 12, 2023, the US moved its clocks forward. In my test, the two results were 82,800 seconds apart, which is 23 hours. Adding 24 hours with 24 hours gave 86,400 seconds. Pick the one that matches your goal. A token that must last exactly 24 hours needs seconds. A report for the next calendar day needs the day.

There is one more trap. Writing +1 day right after a clock time can be read as a time zone offset. On GNU date 9.7, 2023-03-11 12:00 + 1 day returned a wrong value, 18 hours later instead of one day. Write 1 day without the plus sign, or use now or tomorrow.

Linux Time Zones: TZ and the System Setting

An epoch value has no zone. The zone only matters when you print a date. On Linux, the TZ variable changes the zone for one command, and the system zone is set with timedatectl.

TZ=Asia/Karachi date -d @1700000000 '+%F %T %z %Z'
2023-11-15 03:13:20 +0500 PKT

For logs, write and read in UTC, then convert for display. If you collect logs from many servers, mixed zones make a timeline hard to follow.

Year 2038 on Linux: Kernel, glibc and Filesystems

The 2038 limit is not one switch. It depends on the kernel, the C library, the program, and the filesystem. A 64-bit system with a modern filesystem is in good shape. The risk is on 32-bit systems and on old disk formats.

Part Safe when At risk when
32-bit kernel Time64 system calls exist from kernel 5.1, and the support is complete from 5.6 Kernel older than 5.1
glibc on 32-bit Version 2.34 or newer, built with _TIME_BITS=64 and _FILE_OFFSET_BITS=64 Default build, because 64-bit time is opt-in
ext4 with 256-byte inodes Dates reach 2446-05-10 22:38:55 UTC Not at risk before 2446
ext4 with 128-byte inodes, ext3, ext2 Not safe Limit is 2038-01-19 03:14:07 UTC
XFS with bigtime (Linux 5.10 and newer) Dates reach the year 2486 XFS without bigtime, limit is 2038

You can read the inode size of an ext4 volume with tune2fs -l /dev/sdXn | grep 'Inode size'. You cannot change it on a live filesystem, so an old volume may need a move to a new one. For XFS, run xfs_info /mount | grep bigtime. The tool above gives the limit for each case.

Common Linux Timestamp Mistakes

Mistake What happens Fix
Reading a journald value as seconds A date very far in the future Divide by 1,000,000 first
Reading an audit serial as part of the time Wrong digits in the date Use only the part before the colon
Trusting dmesg -T after suspend Dates that drift Use journalctl -k
Reading a shadow day count as seconds A time on the morning of January 1, 1970, since 19675 seconds is about 5.5 hours Multiply days by 86,400
Writing +1 day after a clock time Read as a zone offset Write 1 day or use tomorrow
Adding 86,400 seconds for a calendar day Off by one hour on clock change days Use 1 day in date -d
Using local time to compare servers Events appear out of order Use UTC

Conclusion

A good Linux timestamp converter must know where the number came from. A journald value, an audit time, a dmesg offset, and a shadow day count all need different handling. Keep the key commands close: date -u -d @ for epoch values, systemd-analyze timestamp @ and journalctl --since @ for systemd, and btime for boot time. Use the tool at the top when you have a mixed set of values. If you only have one plain number, the Unix time converter on timestampconverter.app is also quick and works in any browser.

Linux Timestamp FAQ

How do I convert a journald timestamp to a date?

The field __REALTIME_TIMESTAMP holds microseconds. Divide it by 1,000,000 and pass the result to date -u -d @. You can also run journalctl -o short-unix to see seconds with a fraction.

What does the number in an audit log line mean?

In msg=audit(1364481363.243:24287), the part before the colon is the time in seconds and milliseconds. The part after the colon is the event serial number.

Why does dmesg show seconds instead of a date?

The kernel log stores the time since boot, not a wall clock time. Add the value to the boot time from /proc/stat to get a date.

How do I convert the days in /etc/shadow to a date?

Run date -u -d '1970-01-01 +DAYS days' +%F and replace DAYS with the number. As root, chage -l username prints the dates for you.

Does Linux have a year 2038 problem?

Mostly on 32-bit systems and on old filesystem formats. 64-bit systems are fine for a very long time. ext4 with 256-byte inodes lasts until 2446, and XFS with bigtime lasts until 2486.

How do I find files changed after a given epoch time?

Run find /path -newermt @1700000000. The at sign tells GNU find to read the value as epoch seconds.