title: PHP extract date from filename returned in foreach
body: <p>Using PHP given that I have a foreach loop going through via glob to output some images, I would like to extract the date and time the images were uploaded.</p>
  
  <p>I have them named as follows when they are uploaded: </p>
  
  <pre><code>1234567_29052017-122959.jpg
  </code></pre>
  
  <p>The first sequence of numbers before the _ is an account number, this is to be stripped out. The second sequence of numbers is the date, so 29/05/2017. The third sequence of numbers is the time of day, so 12:29:59. Each filename is output as $image in the foreach below:</p>
  
  <pre><code>$dirname = 'photos/' . $account . '/';
  $images = glob($dirname.'*.jpg');
  
  If ($images == null ) {
      echo "There was no photos returned for the account number that you entered.";
  } else {
  
      foreach($images as $image) {
          echo '
              &lt;div class="viewerContent" style="width:220px; min-height: 160px;"&gt;Insert Date Here &lt;br /&gt;
              &lt;a href="'.$image.'"&gt;&lt;img src="'.$image.'" width="220" height="160" title="'.$image.'" /&gt;&lt;/a&gt;&lt;br /&gt;
              &lt;/div&gt;';
      }   
  
  }               
  </code></pre>
  
  <p>What I want to is extract the following from the above given example.</p>
  
  <pre><code>1234567_29052017-122959.jpg
  </code></pre>
  
  <p>To</p>
  
  <pre><code>29/05 12:29:59s 
  </code></pre>
  
  <p>Can anyone assist me in achieving this?</p>
  
  <p>I am going to add the resulting timestamp to the foreach in the Insert Date Here section of the repeating echo.</p>