dedecms 織夢顯示時間格式

field:pubdate function=GetDateMK(@me)/] 2009-11-10php

[field:pubdate function=GetDateTimeMK(@me)/] 2009-11-10 12:20:20.net

[field:pubdate function="GetDateMK(@me)"/] 2009-11-10blog

[field:pubdate function="GetDateTimeMK(@me)"/] 2009-11-10 12:20:20io

[field:pubdate function=MyDate('m-d',@me)/] 11-10function

{dede:field.pubdate function="MyDate('Y-m-d H:i',@me)"/} 2009-11-10 12:20date

 

 


一、時間格式im

{dede:field name=’pubdate’ function=’strftime(「%Y年%m月%d日 %H:%M:%S」,」@me」)’ /}
2007年1月1日 18:30:02時間

{dede:field name=’pubdate’ function=’strftime(「%Y-%m-%d %H:%M:%S」,」@me」)’ /}
2007-1-1 18:30:02co

{dede:field name=’pubdate’ function=’strftime(「%Y年%m月%d日 %H時%M分%S秒「,」@me」)’ /}
2007年1月1日 18時30分02秒360

{dede:field name=’pubdate’ function=’strftime(「%m-%d %H:%M:%S」,」@me」)’ /}
1-1 18:30:02

{dede:field name=’pubdate’ function=’strftime(「%m-%d」,」@me」)’ /}
1-1

%Y-年
%m-月
%d-日
%H-小時
%M-分
%S-秒

二、24小時內的時間顯示紅色..

[field:pubdate runphp='yes']
$a=」<font color=’#ff0000′>」;
$b=」</font>」;
$c=strftime(「%Y年%m月%d日 %H:%M:%S」,」@me」);
$ntime = time();
$oneday = 3600 * 24;
if(($ntime – @me)<$oneday) @me = $a.$c.$b;
else @me =$c;
[/field:pubdate]

三、最後更新時間

最後更新時間:{dede:tagname runphp=’yes’}@me = date(「Y-m-d H:i:s」, time());{/dede:tagname}

四、XX天前

[field:pubdate runphp='yes']$today = Floor(time()/(3600 * 24));$senday= Floor(@me/(3600 * 24));$updays = $today-$senday;if($updays==0) @me = 「今日」;else @me = $updays.」天前」;[/field:pubdate]--------------------- 做者:綺羅 來源:CSDN 原文:https://blog.csdn.net/ruoyuanyi/article/details/9225091 版權聲明:本文爲博主原創文章,轉載請附上博文連接!

相關文章
相關標籤/搜索