I got something incorrect, inputting 1777777777 gave me sunday may 5 2026 but that day is a tuesday
Show HN: A Unix timestamp converter that includes the micro and nanoseconds
21–27 of 27 posts
Re: Show HN: A Unix timestamp converter that includes the micro and nanoseconds
#22Earlier quoted context omitted.
What do you mean by varying precision? Do you have an example? Thanks
At first I didn't understand the input format, which seems to try and autodetect the units. When I enter 1e-3, I get 1ms past epoch start, but 1e-4 is 0ms past epoch start. And that isn't what I'd expect. Here's another odd one, or why I wonder what internal precision things are calculated to: 1234567800000000090.000 is Friday February 2 2009 11:30:00.000,90.,000 PM +00:00 (nanos) But 1234567800000000090.0001 is Frid…
Re: Show HN: A Unix timestamp converter that includes the micro and nanoseconds
#23Reminds me of a call I was on a few weeks ago where someone went off that Unix epoch with milliseconds wasn’t the Unix epoch. Made it a huge point that it wasn’t and would correct everyone who tried to refer to it as that. I did Google it and he technically is right. But it’s also a stupid hill to die on.
Your colleague is absolutely correct. That was the same objection I had to this. Unix timestamp format is only seconds. This page shows a timestamp but not a Unix timstamp, so the hill people are dying on here is to take and reuse a name for a different format out of their own stubborness - even after they learned they are wrong. It's very confusing and rejected by tools that only work with unix timestamps. That said…
I'll contact the original author as well. This is definitely an issue that should be listed in "falsehoods that programmers believe about time".
Re: Show HN: A Unix timestamp converter that includes the micro and nanoseconds
#24Doesn't 'date' do this on the commabd line?
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.
Re: Show HN: A Unix timestamp converter that includes the micro and nanoseconds
#25Mate, I'm very confused. The first result in Google [1] which I often use, lets me paste a unix timestamp in seconds, milliseconds or nano seconds, and it accordingly converts it to a Human readable string. Is that not the feature you built this for? [1] - https://www.epochconverter.com/
Take the timestamp "1677951565000123456" for example - If I put it into the link you posted, it just gives me "Saturday, March 4, 2023 11:39:25 AM". While it's a minor drawback, it requires another step to figure out the microsecond and nansecond part of the timestamp since it's not in the output. My website would display "Saturday March 3 2023 11:39:25.000,123,456 AM -06:00 (nanos)", which gives you "000,123,456" te…
It looks like it only gives millisecond resolution in the output, and only displays milliseconds if there is at least 1 millisecond. Give it 1677951565020123456 and then you will get 11:39:25.020.
Re: Show HN: A Unix timestamp converter that includes the micro and nanoseconds
#26Doesn't 'date' do this on the commabd line?
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.
date "+%F %T.%N"