title: How do I format a list of dates from an array of unix timestamps?
body: <p>A WordPress plugin that I'm using is outputting an array (which should be only two dates/times) that looks like this:</p>
  
  <pre><code>Array ( [0] =&gt; 1412037900 [1] =&gt; 1413340200 [2] =&gt; )
  </code></pre>
  
  <p>I'm not sure why there's a trailing empty node but in any case, I'm trying to get a list of the formatted dates/times from this.</p>
  
  <p>I have this in my php (the get_post_meta function is returning the array):</p>
  
  <pre><code>&lt;?php global $post;
  $date = get_post_meta( $post-&gt;ID, '_cmb2_date_time', true );
  foreach ( $date as $item ) {
  echo '&lt;p&gt;' . date("F j, Y, g:i a", (int)$item) . '&lt;/p&gt;';
  } ?&gt;
  </code></pre>
  
  <p>Right now I'm getting this:</p>
  
  <pre><code>September 30, 2014, 12:45 am
  October 15, 2014, 2:30 am
  January 1, 1970, 12:00 am
  </code></pre>
  
  <p>And what I want is this:</p>
  
  <pre><code>September 30, 2014, 12:45 am
  October 15, 2014, 2:30 am
  </code></pre>
  
  <p>Eventually I'd also like to make it conditional so that it echoes "TBA" when there are no dates.  I can worry about that later once it's working but at the moment when the array is empty I get an error that says "Warning: Invalid argument supplied for foreach()..."</p>
  
  <p>Any help would be greatly appreciated!</p>