PHP Custom Date English format Feb 11,2015

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.