Hacker News new | ask | show | jobs
by gdevenyi 1207 days ago
Doesn't 'date' do this on the commabd line?
3 comments

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.

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"
gdate if you’re using home brew on Mac
If you stopped people from posting about their amazing new project that replicates standard functionality from classic unix tools we'd have very little left.
Cool. Let’s stop people from discussing these ‘amazing’ projects then. That sounds productive.