title: Change time from 12 hour format to 12 hour AM/PM format
body: <p>I've set the timezone on my website pages as such:</p>
  
  <pre><code>date_default_timezone_set("America/Los Angeles");
  </code></pre>
  
  <p>I've declared a time variable as such:</p>
  
  <pre><code>$time = date("h:i:sa");
  </code></pre>
  
  <p>then adding it to the database. I then retrieve the time from the database like such, trying to reformat it:</p>
  
  <pre><code>$time2 = date("h:i A", strtotime($row['Time'])); 
  </code></pre>
  
  <p>and then printing out the time:</p>
  
  <pre><code>echo $time2;
  </code></pre>
  
  <p>This method, however, messes up AM and PM. If $time was added to the database at 11:59:00 at night, for example, it will print out 11:59 AM, not 11:59 PM. I think the issue is that when the time is added to the database, no clear distinction is made between AM and PM. However, I'm still unsure how  to fix this. I've tried adding the time with the AM PM already in it, like such: </p>
  
  <pre><code>$time = date("h:i:sa A");
  </code></pre>
  
  <p>and then accessing it like such:</p>
  
  <pre><code>$time2 = $row['Time'];
  </code></pre>
  
  <p>but this still doesn't fix the bug. Is there a way around this while keeping my 12 hour format? Or do I have to change to 24 hour format to get this to work?</p>