KB Article #177592

Convert Unix timestamp to human readable form in Linux shell

Problem

When SecureTransport logs are exported from the database, their date and time format are in Unix timestamp with milliseconds added, and are hard to read by humans.


Resolution

You can convert the timestamp to human readable date with the below commands. This example uses the timestamp (with milliseconds):


1449871200849


The first 10 digits are the time and date and the last 3 digits are the milliseconds.


Converting Unix timestamp without milliseconds:


Command:


# date -d @1449871200


Output:


Sat Dec 12 00:00:00 EET 2015


Converting unix timestamp with milliseconds


Command:


#  date -d @$(echo "(1449871200849+500)/1000" | bc)


Output:


Sat Dec 12 00:00:01 EET 2015