Skip to main content

Add an alias for doing Unix timestamp -> date string

ID
adb221f
date
2024-02-21 15:37:18+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
6fb882d
message
Add an alias for doing Unix timestamp -> date string
changed files
2 files, 22 additions, 1 deletion

Changed files

text/README.md (8094) → text/README.md (8564)

diff --git a/text/README.md b/text/README.md
index 43a32dc..1bc64dd 100644
--- a/text/README.md
+++ b/text/README.md
@@ -45,6 +45,12 @@ scripts = [
         """,
     },
     {
+        "usage": "fromtimestamp [TIMESTAMP]",
+        "description": """
+        convert a Unix timestamp to a human-readable date.  Alias for <code>date -r [TIMESTAMP]</code>.
+        """,
+    },
+    {
         "usage": "longlines [PATH]",
         "description": "print the line numbers of the longest lines in the file."
     },
@@ -154,6 +160,15 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts, i
   </dd>
 
   <dt>
+    <a href="https://github.com/alexwlchan/scripts/blob/main/text/fromtimestamp">
+      <code>fromtimestamp [TIMESTAMP]</code>
+    </a>
+  </dt>
+  <dd>
+    convert a Unix timestamp to a human-readable date.  Alias for <code>date -r [TIMESTAMP]</code>.
+  </dd>
+
+  <dt>
     <a href="https://github.com/alexwlchan/scripts/blob/main/text/longlines">
       <code>longlines [PATH]</code>
     </a>
@@ -265,4 +280,4 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts, i
     "codepoints. This is a Docker wrapper around <a href="https://github.com/lunasorcery/utf8info">a tool of the same name</a> by @lunasorcery.
   </dd>
 </dl>
-<!-- [[[end]]] (checksum: 6093300a8e3cc8d5dd508f4a3eb4e3cc) -->
\ No newline at end of file
+<!-- [[[end]]] (checksum: 49d227b94b5dd07ca39ceeda39ef31c2) -->
\ No newline at end of file

text/fromtimestamp (0) → text/fromtimestamp (65)

diff --git a/text/fromtimestamp b/text/fromtimestamp
new file mode 100755
index 0000000..b77cf84
--- /dev/null
+++ b/text/fromtimestamp
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+
+date -r "$@"