[DISCLAIMER: This question is intended to be in question and answer format. The solution has already been determined and is provided with the question.]
Without adequate examples from the busybox help section, I was unable to determine the how to get date to print out the 'seconds' version of iso8601. The help does not provide examples to help understand the syntax required. Here are different ways that were tried to get the desired format without much luck. How does one get ISO8901 seconds format from the "date" in busybox?
Here is what was tried:
➤ date -I=seconds
➤ date -I SPEC='seconds'
➤ date -I seconds
➤ date -I='seconds'
➤ date -I 'seconds'
➤ date -I['seconds']
➤ date -I TIMESPEC='seconds'
➤ date -I TIMESPEC=seconds
Note I have tried to use the Ubuntu version of date and was able to figure out how to get the iso8601=seconds format of date, but not in busybox...
Here is what the help of date shows for Busybox 1.22.1:
BusyBox v1.22.1 (2014-09-26 07:33:17 CEST) multi-call binary.
Usage: date [OPTIONS] [+FMT] [TIME]
Display time (using +FMT), or set time
[-s,--set] TIME Set time to TIME
-u,--utc Work in UTC (don't convert to local time)
-R,--rfc-2822 Output RFC-2822 compliant date string
-I[SPEC] Output ISO-8601 compliant date string
SPEC='date' (default) for date only,
'hours', 'minutes', or 'seconds' for date and
time to the indicated precision
-r,--reference FILE Display last modification time of FILE
-d,--date TIME Display TIME, not 'now'
-D FMT Use FMT for -d TIME conversion
The documentation (i.e., date --help) is confusing. Example usages in the documentation can help reduce this confusion and at least help socialize the syntax.
The main difference from the above examples is a "space" that messes up the command. See below:
Was off by a hair. It needed a space removed:
Now busybox date is happy.