Unix Timestamp in Bash
Look up the current epoch time and convert between Unix seconds and UTC dates in Bash.
Get the current timestamp
date -u +%sTimestamp to date
if date --version >/dev/null 2>&1; then
date -u -d @1700000000 '+%Y-%m-%dT%H:%M:%SZ'
else
date -u -r 1700000000 '+%Y-%m-%dT%H:%M:%SZ'
fiDate to timestamp
if date --version >/dev/null 2>&1; then
date -u -d '2023-11-14T22:13:20Z' +%s
else
date -u -j -f '%Y-%m-%dT%H:%M:%SZ' '2023-11-14T22:13:20Z' +%s
fiOpen 1700000000 in the converter
Current Unix time
Seconds—
Milliseconds—
- UTC
- —
- My time zone
- —
Free to use. Your input stays in this browser.
How to use it
- Copy the current-time example into your Bash environment to read Unix seconds.
- Run the second example to display 1700000000 as a UTC date.
- Run the last example to convert that date back into seconds.
Bash uses the system date command. GNU date takes -d, while macOS uses -r for epoch seconds and -j -f to parse a date without changing the system clock.