_
_ Handy PHP
_
_
Tutorials, Scripts, Information And Other Resources arrow PHP Functions arrow Reformat Date
Tuesday, 06 January 2009
_

Refer A Friend using Revolution Money Exchange
Resource Menu
Handy PHP Store
Free Domain Name
PHP Functions
PHP Downloads
PHP Newsfeeds
PHP Tutorials
Webmaster Tools
User Login
TalkPHP
Get friendly help with your PHP problems for free.
www.talkphp.com
The PHP Resource Index
 
Handy PHP
Free PHP Help!


 
This Section Is Scheduled
For Maintenance

    The format of the PHP Functions section here at Handy PHP needs some attention soon.  Recent changes to the website have brought to light some significant layout problems with this section.  The need for a standard format for all functions has resulted in the problems.  Each function will be reformated, enhanced, archived, and updated as time allows. In the meantime, some screen resolutions may display a distorted version of the website.
Thank you for your visit and patience.

If you encounter any major problems with viewing the functions, please inform us via the forums.
If you are unable to find what you needed here, please let us know what you wanted in the forums so that we may add relevant content in the future.

Reformat Date Print E-mail
User Rating: / 3
PoorBest 
PHP Resources - Handy PHP Functions
Written by M. L. Griswold   
Sunday, 03 September 2006
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().


Discuss this article on the forums. (3 posts)
 
< Prev   Next >

_
 
_
_
© 2009 Handy PHP