aboutsummaryrefslogtreecommitdiff
path: root/bin/bin/epoch
diff options
context:
space:
mode:
Diffstat (limited to 'bin/bin/epoch')
-rwxr-xr-xbin/bin/epoch9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/bin/epoch b/bin/bin/epoch
new file mode 100755
index 0000000..ba45b02
--- /dev/null
+++ b/bin/bin/epoch
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# get seconds since epoch
+test "x$1" == x && date +%s && exit 0
+
+# or convert epoch seconds to date format (see "man date" for options)
+EPOCH="$1"
+shift
+date -d @"$EPOCH" "$@"