4

Here's something that should be a standard rule for writing APIs:

When you offer a date filter for your API, the date format passed in should be a UNIX timestamp and not a literal date. For example,

Incorrect API URL format: '?start_date=2024-03-01&end_date=2024-04-01'

Correct API URL format: '?start_date=1709251200&end_date=1711929600'

Comments
  • 7
    No. ISO 8601.

    Reading a number like 1709251200, you don’t know what the date is. You need to convert it first. That is dogshit.
  • 0
    @Lensflare I checked what that thing is. And no, UNIX timestamp is better.
  • 5
    @SidTheITGuy that thing is the literal standard for dates and is built into every std lib in every language.
    If you didn‘t know about it, you obviously have too few experience on that topic and are not qualified to make such a claim.
  • 2
    Knock knock. Who's that? Leap seconds. Leap seconds who? Leap seconds I will fuck you in the ass. Is that a real name or just an alias? Bitch, just open the door!
  • 3
    Unless you can do the conversion in your head it adds work to debugging... Human readable where feasible.
  • 2
    ISO 8601 is the de facto standard, keep following it.
Add Comment