Cheatsheet

I'm not googling that again

Get a human friendly date out of an epoch timestamp

The flags used for the date command are a bit different depending on whether you're using GNUs or *BSD versions of it. For practical purposes, you can see this Linux or macOS.

Getting the current date (Both Linux and macOS)

# Get the current date in format YYYY-MM-dd
date +%F # 2023-04-06
# Get the current date in epoch seconds
date +%s # 1680792138

Reading an epoch timestamp

On Linux

# Convert epoch seconds into a human-readable date 
date -d @1680792138 # jue 06 abr 2023 16:42:18 CEST
# Convert epoch seconds into YYYY-MM-dd
date -d @1680792138 +%F

On *BSD (macOS)

# Convert epoch seconds into a human-readable date 
date -r 1680792138 # jue 06 abr 2023 16:42:18 CEST
# Convert epoch seconds into YYYY-MM-dd
date -r 1680792138 +%F

References and further info