Hacker News new | ask | show | jobs
by donio 1206 days ago
date +'%F %H:%M:%S.%N' -d @1677954553.2134567654

Adjust the format as desired.

Or if there is the number of nsecs rather than the fraction:

date +'%F %H:%M:%S.%N' -d @$(dc -e '9k 16779545532134567654 10 9^/p')

The dc stuff is RPN, k sets the precision, p is print.

1 comments

I got in the habit of using %T for Time (of day), as a shorthand for %H:%M:%S, but I can't recall how portable that is.

  date "+%F %T.%N"