Last active
August 9, 2022 03:23
-
-
Save gh640/592e733300be9a2f999d75e394dc14a1 to your computer and use it in GitHub Desktop.
Get and parse timestamp on macOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also: