Skip to content

Instantly share code, notes, and snippets.

@gh640
Last active August 9, 2022 03:23
Show Gist options
  • Save gh640/592e733300be9a2f999d75e394dc14a1 to your computer and use it in GitHub Desktop.
Save gh640/592e733300be9a2f999d75e394dc14a1 to your computer and use it in GitHub Desktop.
Get and parse timestamp on macOS
# Get timestamp of current date/time.
alias timestamp='date "+%s"'
# Get timestamp of today 00:00:00.
alias timestamp_today='date -v0H -v0M -v0S "+%s"'
# Take timestamp and print it in human-readable format (in the current timezone).
alias timestamp_parse='date -r'
# Take timestamp and print it in human-readable format (in UTC).
alias timestamp_parse_utc='TZ=UTC date -r'
@gh640
Copy link
Author

gh640 commented Aug 9, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment