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:

1674994207

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. https://www.cyberciti.biz/faq/unix-date-command-howto-see-set-date-time/
  2. https://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/
  3. https://www.cyberciti.biz/tips/linux-unix-get-yesterdays-tomorrows-date.html
1 Like