Created
April 22, 2022 09:55
-
-
Save ml-eds/504200e850a41b1cfbe55cac4bd18941 to your computer and use it in GitHub Desktop.
Unix timestamp to date bash / zsh
This file contains 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
# Convert Unix timestamp to date in zsh/bash | |
# | |
# Add to .zshrc or .bash_profile | |
# | |
# Example usage: ts2date 1650621128 | |
# Example output: 2022-04-22 11:52:08 | |
timestamp2date() { | |
date -r "$1" '+%Y-%m-%d %H:%M:%S' | |
} | |
alias ts2date='timestamp2date' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment