Is there a quick, one-liner way to convert a Unix timestamp to a date from the Unix command line?
date might work, except it’s rather awkward to specify each element (month, day, year, hour, etc.), and I can’t figure out how to get it to work properly. It seems like there might be an easier way — am I missing something?
With
datefrom GNU coreutils you can do:(From: BASH: Convert Unix Timestamp to a Date)
On OS X, use
date -r.Alternatively, use
strftime(). It’s not available directly from the shell, but you can access it via gawk. The%cspecifier displays the timestamp in a locale-dependent manner.