buckket / twtxt

Decentralised, minimalist microblogging service for hackers.
http://twtxt.readthedocs.org/en/stable/
MIT License
1.91k stars 79 forks source link

Simplify `date` command #129

Closed IBPX closed 6 years ago

IBPX commented 7 years ago

I believe date +%FT%T%:z is exactly the same as writing date -Isecond, just more complicated. They are both the same format, and you can run them at the same time and get the exact same result.

Relevant section of man date:

       -I[FMT], --iso-8601[=FMT]
              output date/time in ISO 8601 format.  FMT='date' for  date  only
              (the  default),  'hours', 'minutes', 'seconds', or 'ns' for date
              and    time    to    the    indicated    precision.     Example:
              2006-08-14T02:34:56-0600
buckket commented 6 years ago

Yes, that’s seems to do the trick :)

jomo commented 6 years ago

This doesn't work with all implementations of the date command.

BSD implementations don't have the -I flag, it's probably a gnu coreutils thing, it's not required to be POSIX compatible.

IBPX commented 6 years ago

@jomo In that case, it should be left as it was, date +%FT%T%:z. That's an oversight on my part.