title: From unix time in seconds to datetime in ISO-8601
body: <p>TL;DR. How to go from unix time in seconds to datetime in ISO-8601 format ? This looks more like a library question than a language question.</p>
  
  <p>I would like to be able to interpret the ping timestamp (unix time + microseconds) as a datetime to be able to visualize it or perform date and time operations on it. I have a long ping trace (thousands of lines) where each line indicates the success or failure of the ping.</p>
  
  <p>I already managed to make a toy example using a regular expression to get the unix time (without the microseconds) but I didn't find how to use datetimes in APL. I found the APLtree project on Github by the APLteam and their sub-project called <code>DateAndTime</code> but I couldn't intall it. I don't know how to proceed.</p>
  
  <p>Note that I know that I already have the datetime written explicitly in ISO-8601 format in front of the ping timestamp but for the sake of learning the basics of APL I would like to manipulate datetimes. I could also perform operations on the unix times and then try (but how) to convert them to a datetime in ISO-8601 format.</p>
  
  <p>The trace is generated on Linux with the command:</p>
  
  <pre><code>ping -n -i 30 -O -D my.domain.name | while read pong; do echo "[WAN] $(date --iso-8601=seconds): $pong"; done
  </code></pre>
  
  <p>The output trace is:</p>
  
  <pre><code>[WAN] 2020-01-31T18:02:35+0100: [1580490155.323878] 64 bytes from 8.8.8.8: icmp_seq=1037 ttl=234 time=720 ms
  [WAN] 2020-01-31T18:03:34+0100: [1580490214.630890] no answer yet for icmp_seq=1038
  </code></pre>
  
  <p>The APL program:</p>
  
  <pre><code>      v←('\[(\d+)\.'⎕S'\1')⊃⎕NGET'/Users/ludo/Desktop/so/ping.txt' 1
        v
   1580490155  1580490214
        ⍴v
  2
        DISPLAY v
  ┌→──────────────────────────┐
  │ ┌→─────────┐ ┌→─────────┐ │
  │ │1580490155│ │1580490214│ │
  │ └──────────┘ └──────────┘ │
  └∊──────────────────────────┘
  </code></pre>
  
  <p>I have another question: why the rank difference between the usage of <code>[]</code> and <code>⊃</code> ? Do we have a vector in one case and a simple string in the other one (scalar) ? Why is <code>⍴⍴v[1]</code> zero ? See the example below.</p>
  
  <pre><code>      v←⎕NGET'/Users/ludo/Desktop/so/ping.txt' 1
        v
    [WAN] 2020-01-31T18:02:35+0100: [1580490155.323878] 64 bytes from 8.8.8.8: ic
        mp_seq=1037 ttl=234 time=720 ms  [WAN] 2020-01-31T18:03:34+0100: [1580490
        214.630890] no answer yet for icmp_seq=1038   UTF-8-NOBOM  13 10
        DISPLAY v
  ┌→───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ┌→─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ ┌→──────────┐ ┌→────┐ │
  │ │ ┌→───────────────────────────────────────────────────────────────────────────────────────────────────────────┐ ┌→──────────────────────────────────────────────────────────────────────────────────┐ │ │UTF-8-NOBOM│ │13 10│ │
  │ │ │[WAN] 2020-01-31T18:02:35+0100: [1580490155.323878] 64 bytes from 8.8.8.8: icmp_seq=1037 ttl=234 time=720 ms│ │[WAN] 2020-01-31T18:03:34+0100: [1580490214.630890] no answer yet for icmp_seq=1038│ │ └───────────┘ └~────┘ │
  │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ └───────────────────────────────────────────────────────────────────────────────────┘ │                       │
  │ └∊─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘                       │
  └∊───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
        ⍴v
  3
        v[1]
    [WAN] 2020-01-31T18:02:35+0100: [1580490155.323878] 64 bytes from 8.8.8.8: ic
        mp_seq=1037 ttl=234 time=720 ms  [WAN] 2020-01-31T18:03:34+0100: [1580490
        214.630890] no answer yet for icmp_seq=1038
        ⊃v
   [WAN] 2020-01-31T18:02:35+0100: [1580490155.323878] 64 bytes from 8.8.8.8: icm
        p_seq=1037 ttl=234 time=720 ms  [WAN] 2020-01-31T18:03:34+0100: [15804902
        14.630890] no answer yet for icmp_seq=1038
        ⍴v[1]
  
        ⍴⊃v
  2
        ⍴⍴v[1]
  0
        ⍴⍴⊃v
  1
  </code></pre>