Full PHP class, usually I will cooperate with smary use, quick use.
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"); // % */
The above describes the PHP version of the implementation of a friendly time display (such as: 1 minutes ago), including aspects of the content, I hope to be interested in the PHP tutorial friends helpful.