PHP – Date Conversion


  /* (c) 2003 Drew Butler 
   * If you use this code please remember who wrote it. :) 
   * 
   * Simple conversion tool that takes the standard date format of 
   * yyyy-mm-dd and turns it into MM-dd-yyyy 
   */ 
   
  function convert_date ($date, $type='short') { 
    $month_list['short'] = array ('', 'Jan.', 'Feb.', 'Mar.', 'Apr.', 
      'May', 'June', 'July', 'Aug.',' Sept.', 'Oct.', 'Nov.', 'Dec.'); 
    $month_list['long'] = array ('', 'January', 'February', 'March', 
      'April', 'May', 'June', 'July', 'August', 'September', 'October', 
      'November', 'December'); 
    list($year, $m, $day) = split("-", $date);     
    $date = $month_list[$type][intval($m)] . " " . $day . " " . $year; 
    return $date; 
  } 
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.