Show HN: An easy way to convert time
epoch.sh
epoch.sh
Unix command line with GNU date:
date --iso-8601=seconds
date --iso-8601=seconds -u # UTC
date --iso-8601=seconds -d @1234567890 # specified time stamp
date -d 2017-06-29T12:28:57-07:00 +%s # other direction
Python: https://stackoverflow.com/questions/2150739/iso-time-iso-860...
Using a network API for this kind of conversion function that's already built into programming languages reminds me of the left-pad controversy. You don't need to outsource basic programming tasks to third-party libraries, and you also don't need to outsource them to third-party network services.
The API is definitely not useful for most programmatic things. Just a simple way to get the time if you don't have the ability to use bash or a programming language.
I mostly wanted a way to copy a timestamp and type in a url to get a human readable time in local time. (https://epoch.sh/1498769628)
I agree, when talking about programming language, but maybe could be useful when using services like Zapier and similar, when you don't want to use a programming language for doing simple things or don't know programming.
https://api.epoch.sh/2016-12-31T23:59:60Z
Edge case, but 2016-12-31T23:59:60Z is a valid UTC time.
"unix": 9999999999, "utc": "2286-11-20T17:46:39Z"
edit: No, I was very wrong. Adding another 9 seems to work. However, moving up one to 10000000000 does not.
edit2: Okay I wasn't wrong. It just was changed by the OP very quickly. Which I guess makes this entire post wrong now. But let the record reflect for a very brief period in my life I was correct.
In Powershell, it's a one-liner.
PS C:\> (Get-Date 1/1/1970).addSeconds(10413795600)
Monday, January 01, 2300 1:00:00 AMShould be fixed now
⏵ http https://api.epoch.sh/
HTTP/1.1 200 OK
...
Date: Thu, 29 Jun 2017 21:06:20 GMT
...
{
"utc": "2017-06-29T21:06:19Z"
}
One second off. ;)`{"local":"0099-12-31T16:00:00-08:00","unix":-59011459200,"utc":"0100-01-01T00:00:00Z"}`
This too:
`{"local":"8675-11-04T16:00:00-08:00","unix":211615977600,"utc":"8675-11-05T00:00:00Z"}`
I actually built a similar tool a while ago: http://timeconv.io/ that's similar to yours :) The goal is to provide a set of useful time/date utilities.
Edit: This is probably way over thinking it, but here are the Amazon data center IP's. Search "CLOUDFRONT" https://ip-ranges.amazonaws.com/ip-ranges.json to see the list of regions.
I like it, a cool and useful project for sure.
I will try and do so tomorrow.