Background: The [PHP gadget] project often requires multi-version language support, and dates are essential components.
English and American, for example, for the date of writing.
United States: Month Day year (January 8th,2014 or January 8,2014)
UK: Day of the month (8th january,2014 or 8 january,2014)
Then, next share a Date conversion tool function Getmydate, using the "January 8,2014" format, you can expand it if necessary.
PHP:class.util.php
Class Util {
public static function Getmydate ($d) {
$marr =array (' January ', ' February ', ' March ', ' April ', ' may ', ' June ', ' July ', ' August ', ' September ', ' October ', ' November ' , ' December ');
$stamp = Strtotime ($d);
$m = Date (' m ', $stamp);
return substr ($marr [$m-1], 0,3). ' '. Date (' d ', $stamp). ', '. Date (' Y ', $stamp); --Truncate the first three characters of an array element
}
}
Call:
$time = Date (' y-m-d g:i:s ');
echo util::getmydate ($time);
Summary: Every day to have gains, a small step forward every day, accumulated bit by bit, is the source of power in life, but also the key to success.
PHP Custom Date English format Feb 11,2015