Current Unix Timestamp SECONDS SINCE JAN 01 1970

Current UTC Time
2025-08-20
Convert Unix Timestamp to Datetime in Bash

How to convert Unix timestamp to Datetime in Bash

🎈 🎈 🎈
+1

    #!/bin/bash

    # Unix timestamp representing seconds since the Unix epoch
    unix_timestamp=714764890
    
    # Convert Unix timestamp to Date
    date -d @"$unix_timestamp"            
        

Output:
1992-08-25 17:48:10
Example only. There may be multiple ways to perform this operation.

Code Explanation

In this Bash example, '714764890' is the Unix timestamp for '1992-08-25 17:48:10'. The date -d command with @"$unix_timestamp" converts the Unix timestamp to a human-readable date. The @ tells the date command to interpret the number as a Unix timestamp.
The result is displayed in a format like 'Mon Jan 1 00:00:00 UTC 2018'.



Other useful Bash date functions

Option Description Example
-d Parses the provided string as a date. date -d "2018-07-15 12:30:45" returns Sun Jul 15 12:30:45 UTC 2018
+%s Outputs the Unix timestamp (seconds since 1970-01-01). date -d "2018-07-15 12:30:45" +%s returns 1531656645
-u Uses UTC (Coordinated Universal Time) for the output. date -u returns the current UTC time.
+%Y-%m-%d Formats the date as year-month-day. date +%Y-%m-%d returns 2024-08-28
+%H:%M:%S Formats the time as hours:minutes:seconds. date +%H:%M:%S returns 12:34:56
+%F Formats the date as YYYY-MM-DD (ISO format). date +%F returns 2024-08-28
+%T Formats the time as HH:MM:SS. date +%T returns 12:34:56
@timestamp Interprets the given timestamp as a Unix timestamp. date -d @1514764800 returns Mon Jan 1 00:00:00 UTC 2018
Current Unix Timestamp SECONDS SINCE JAN 01 1970

Current UTC Time
2025-08-20
Ad Banner Placeholder
Ad Banner Placeholder
Ad Banner Placeholder
Ad Banner Placeholder