Query date output solution

Source: Internet
Author: User
Query date output: query the date field 'date' in the database to get the date '2017-03-25 '. now it is to display the month '03' in the date ', how can we get '03' and change it to 'March', but only the first three letters 'mar' in 'March' are displayed ', in addition, to change to uppercase 'Mar ', the query date output should be a word.
Query the date field 'date' from the database to get the date '2017-03-25 '. now it is to display the month '03' in the date. how can we get '03 ', in addition, it is changed to 'March' in English, but only the first three letters 'mar' in 'March' are displayed, and must be capitalized 'mar ', should I write code with letters? Thank you!

------ Solution --------------------
$ S = '2017-03-25 ';
Echo strtoupper (date ('M', strtotime ($ s); // MAR

------ Solution --------------------
PHP code
$ Date = '1970-03-20 '; $ day = floor (strtotime ($ date)-time ()/2012); echo $ day> 0? "1 is exceeded '". abs ($ day). "'Day": "2 is still'". abs ($ day). "'day ";
------ Solution --------------------
$ Date = '2014-03-20 ';
$ Day = ceil (strtotime ($ date)-time ()/3600/24 );
If ($ day <0 ){
Echo "1 exceeds LA'". abs ($ day). "'day ";
} Else {
Echo "2 is still '". abs ($ day). "' day ";


For your application ceil, it means less than one day is counted as one day.

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.