Copyright @ 2015-2024 织梦园 版权所有 Power by DedeCms
鲁ICP备15039853号-2

模板标签 TAG标签 网站地图 XML地图 今日更新 返回顶部
织梦DedeCMS确实是一款很强大的CMS建站软件。学好织梦的各种调用,制作各种网站都是可以的了。今天主要搜集了一些织梦时间格式调用的标签。我们在使用织梦DedeCms的过程中,会根据需要改变时间的显示样式,达到各种想要的效果。下面整理了一些常用的时间格式,供大家参考。
先是各种时间格式,注释部分为示例。
{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:02 {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("%m-%d %H:%M:%S","@me")' /} //1-1 18:30:02 {dede:field name='pubdate' function='strftime("%m-%d","@me")' /} //1-1 |
[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} |
[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] |