title: Get Time from mysql and echo it in any format we want - php
body: <p>Most of you may find this duplicate (almost) question, but I couldn't find solution for what I want in all those discussions out there.</p>
  
  <p>I have a column in mysql database with type = DATETIME, and it saves the time as 2013-08-21 20:26:12.</p>
  
  <p>Now, I can echo it as is, i.e 2013-08-21 20:26:12 on a PHP page but I want to echo it in the following formats:</p>
  
  <ol>
  <li>21st Aug</li>
  <li>21st August, 2013</li>
  <li>8:26 PM, Wednesday - 21st August, 2013</li>
  </ol>
  
  <p>Please direct me if this can be done after fetching the time from database and apply some PHP functions or we can do it at the time of fetching from database?
  And how?</p>
  
  <p>thanks</p>
  
  <p>** Update: or maybe if I can be able to generate time using date(); in php and store it in mysql database as TIME so we can make time queries on it, like searching etc</p>