PHP version of the implementation of a friendly time display (ex: 2 hours ago), PHP display mode _php tutorial

Source: Internet
Author: User
Tags php class

PHP version to achieve a friendly time display (ex: 2 hours ago), the way the PHP display


Full PHP class, usually I will cooperate with smary use, quick Use (plugins/function.rdate.php), more PHP technology development go to PHP Tutorial network, http://php.662p.com

 200601*/) {return date (' Ym ', Strtotime (' +1 month ', Strtotime ($month. ' 01 ')));} function Prevmonth ($month/*200512->200511*/) {return date (' Ym ', Strtotime ('-1 month ', Strtotime ($month. ' 01 ')));}    function Prevday ($day/*20050826*/) {$day = substr ($day, 0,8); Return date (' Ymd ', Strtotime ('-1 day ', Strtotime ($day)));}    function NextDay ($day/*20050826*/) {$day = substr ($day, 0,8); Return date (' Ymd ', Strtotime (' +1 Day ', Strtotime ($day)));}    function Nextexistsday ($day/*20050109*/) {$day = NextDay ($day);    while (!hastopic ($day) && $day < TODAY) {$day = NextDay ($day); } return Hastopic ($day)? $day: false;}    function Prevexistsday ($day/*20050109*/) {global $cfg;    $day = Prevday ($day);    while (!hastopic ($day) && (int) $day > $cfg->origdate) {$day = Prevday ($day); } return Hastopic ($day)? $day: false;} function Prev_day ($day) {$day = substr ($day, 0,8), return date (' Ymd ', Strtotime ('-1 day ', Strtotime ($day)));} function Long_date ($ts) {returnDate ("Y year n month D Day", $ts);} function Day2time ($day) {return @strtotime ($day);} /*echo "
"; Echo strftime (" a%a\n "); A Tuesday echo strftime ("a%a\n"); A Tuesday Echo strftime ("b%b\n"); b April Echo strftime ("b%b\n"); B April Echo strftime ("c%c\n"); C 2006-4-18 3:48:11 Echo strftime ("c%c\n"); C echo strftime ("d%d\n"); D-Echo strftime ("d%d\n"); D echo strftime ("e%e\n"); E echo strftime ("g%g\n"); G Echo strftime ("g%g\n"); G echo strftime ("h%h\n"); H Echo strftime ("h%h\n"); H echo strftime ("i%i\n"); I-Echo strftime ("j%j\n"); J 108 Echo strftime ("m%m\n"); M echo strftime ("m%m\n"); M-Echo strftime ("n%n\n"); n Echo strftime ("p%p\n"); P am Echo strftime ("r%r\n"); R Echo StrftIME ("r%r\n"); R echo strftime ("s%s\n"); S one echo strftime ("t%t\n"); T echo strftime ("t%t\n"); T echo strftime ("u%u\n"); U echo strftime ("u%u\n"); U echo strftime ("v%v\n"); V echo strftime ("w%w\n"); W echo strftime ("w%w\n"); W 2 echo strftime ("x%x\n"); X 2006-4-18 echo strftime ("x%x\n"); X 3:48:11 Echo strftime ("y%y\n"); Y Echo strftime ("y%y\n"); Y 2006 Echo strftime ("z%z\n"); Z China Standard Time Echo strftime ("%%%\n"); //  %                     */

Detailed Description: http://php.662p.com/thread-571-1-1.html

http://www.bkjia.com/PHPjc/912475.html www.bkjia.com true http://www.bkjia.com/PHPjc/912475.html techarticle PHP version of the implementation of a friendly time display (ex: 2 hours ago), PHP display method of the full PHP class, usually I will cooperate with smary use, quick Use (plugins/function.rdate.php), more ph ...

  • 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.