Skip to content

Instantly share code, notes, and snippets.

@kcsinclair
Created September 6, 2023 03:34
Show Gist options
  • Save kcsinclair/7d2b08a13551d777293a11dadc73cd6b to your computer and use it in GitHub Desktop.
Save kcsinclair/7d2b08a13551d777293a11dadc73cd6b to your computer and use it in GitHub Desktop.
Using Linux date to convert dates and handle epoch times
# Display current time in Unix epoch (seconds since 1970-01-01 UTC).
date +%s
# Display a specific time in Unix epoch.
date --date="1 Jan 2000" +%s
#Convert seconds since the epoch (1970-01-01 UTC) to a date
date --date='@2147483647'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment