epochtime #1

  • //
  • guest/
  • perforce_software/
  • sdp/
  • dev/
  • Unsupported/
  • Samples/
  • bin/
  • epochtime
  • View
  • Commits
  • Open Download .zip Download (441 B)
#!/bin/bash
# Contribution from Kent Lewin.
set -u

declare Platform=

# Convert Epoch Time to human-readable format.
if [[ -z "${1:-}" ]]; then
   echo -e "\\nUsage: ${0##*/} <EpocTime>\\n\\nwhere <EpochTime> is a timestamp in Epoch Time form, e.g. 1735646399.\\n"
   exit 1
else
   Platform=$(uname -s)
   if [[ "$Platform" == "Darwin" ]]; then
      date -r "$1" +"%Y-%m-%d-%H%M%S"
   else
      date -d "@$1" +"%Y-%m-%d-%H%M%S"
   fi
fi
# Change User Description Committed
#1 30378 C. Thomas Tyler Added epochtime utility.