Handy PHP
TalkPHP
Get friendly help with your PHP problems for free.
www.talkphp.com
The PHP Resource Index

Refer A Friend using Revolution Money Exchange
Capture media attention
Reformat Date PDF Print E-mail
Written by Handy PHP Administrator   
Sunday, 03 September 2006 15:16
Description:
  string reformat_date(string date, string format) 
     
  This simple little function comes in quite handy when you need to change the format of a date.  Simply enter nearly any date format and this function can convert it to your new format.
     
Function:
  function reformat_date($date, $format){
// Function written by Marcus L. Griswold (vujsa)
// Can be found at http://www.handyphp.com
// Do not remove this header!

    $output = date($format, strtotime($date));
    return $output;
}
   
 
Usage:
  echo reformat_date("Thur, 03 Aug 2006 03:59:10 -0700", "l, F jS, Y G:i:s O");
     
Result:
  Thursday, August 3rd, 2006 6:59:10 -0400
     
Notes:
  This will work for most English date formats.  It is only limited by the limitations of the PHP function strtotime().


{mos_fb_discuss:3}
Last Updated on Monday, 20 October 2008 21:58
 
Capture media attention