title: Bash/Shell Compare a command date/time output with current date/time
body: <p>May I know how can I compare the date from a command output with date command. I have no idea how do I compare them. Basically, I want to compare the command output date/time and current date/time to check the interval time between them. For example:</p>
  <blockquote>
  <p>Command output <strong>date/time = Mar 6 05:37</strong></p>
  <p>Current <strong>date/time = Mar 6 05:38</strong></p>
  </blockquote>
  <p>Therefore, interval <strong>time = 00:01</strong> which is <strong>1 minute</strong>. Appreciate if anyone could assist me on this.</p>
  <pre><code>ls -lrt | tail -1
  
  date
  </code></pre>
  <p><a href="https://i.stack.imgur.com/OcJxd.png" rel="nofollow noreferrer">Refer to this image</a></p>