Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

279
Views
Convert unix timestamp to hh:mm:ss:SSS (where SSS is milliseconds) in AWK

How can I convert unix timestamp to hh:mm:ss:SSS (where SSS is milliseconds) in AWK.

For example:

echo 1456478048306 > time
cat time | awk ....... > readable_time_format
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use bash for that:

#!/bin/bash
ts="1456478048306"
unix_epoch=${ts:0:-3}
ms=${ts:((-3)):3}

echo "$(date -d@"${unix_epoch}" +%H:%M:%S):${ms}"

Btw, of course you can also use awk. However awk does not allow to simplify things here a lot, the algorithm is more or less the same:

awk -v ts="1456478048306" '{
    unix_epoch=substr(ts, 0, length(ts)-3)
    ms=substr(ts, length(ts)-2, 3)
    print strftime("%H:%M:%S", unix_epoch) ":" ms
}'
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!