How to find date using Unix time stamp (Epoch) command

So I want to find date using Unix time stamp (Epoch) command. I have Unix time stamp (Epoch) 1674945327 and I want it converted back to the actual human readable format such as mm/dd/YYYY. Is it possible?

You filed this question under the Unix category. So, are you using macOS? BSD? or Linux? The command may vary as per your Linux or Unix version.

Finding out Unix time under Linux, macOS and *BSD

date +%s

You will see something as follows:


Finding date using Unix time stamp (Epoch) command

The syntax depends upon your Unix or Linux coreutils.

Linux GNU/Date syntax is as follows:

date -d @{unix_time_stamp_here}
date -d @1674994207

FreeBSD/OpenBSD/NetBSD and macOS (BSD/date) syntax

date -r {unix_time_stamp_here}
date -r 1674994207

A note about OS X or macOS users who want GNU/date syntax

On macOS, you can install homebrew and then install the gdate command (GNU date) using the brew command. For example:

brew install coreutils

The syntax for gdate (GNU date):

gdate -d @{unix_time_stamp_here}
gdate -d @1674994207

See also

  1. UNIX Date Command Examples - nixCraft
  2. How To Format Date For Display or Use In a Shell Script - nixCraft
  3. Getting Yesterday's or Tomorrow's date with bash on Linux / Unix - nixCraft
1 Like