iis服务器助手广告广告
返回顶部
首页 > 资讯 > CMS >织梦DEDECMS中的时间格式代码汇总
  • 317
分享到

织梦DEDECMS中的时间格式代码汇总

时间格式 2022-06-12 01:06:46 317人浏览 安东尼
摘要

1.时间格式 {dede:field name='pubdate' function='strftime("%Y年%m月%d日 %H:%M:%S","@me")' /}2007年1

1.时间格式

{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

%Y-年

%m-月

%d-日

%H-小时

%M-分

%S-秒

2.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]

3.最后更新时间

最后更新时间:{dede:tagname runphp='yes'}@me = date("Y-m-d H:i:s", time());{/dede:tagname}

4.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]

--结束END--

本文标题: 织梦DEDECMS中的时间格式代码汇总

本文链接: https://www.lsjlt.com/news/31202.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作