home / system / tools_source

Menu
  • GraphQL API
  • Search all tables

tools_source: 16

This data as json

id tool_id filename language content
16 3 epoch.sh sh #!/bin/sh # epoch — convert between unix timestamps and dates if [ -z "$1" ]; then read -r input else input="$1" fi case "$input" in *[!0-9]*) # input is a date string, convert to epoch date -d "$input" +%s 2>/dev/null || date -j -f "%Y-%m-%d %H:%M:%S" "$input" +%s ;; *) # input is epoch, convert to date date -d "@$input" --iso-8601=seconds 2>/dev/null || date -r "$input" +%Y-%m-%dT%H:%M:%S%z ;; esac
Powered by Datasette · 0.528ms · krisyotam.com