东方星雨

简单网络

一个爱好网络的80后男站长。

关注我东方星雨个人微信号:476847113

您现在的位置是:首页 > 站长日志

帝国CMS灵动标签调用某一天内发布的信息

2018-12-04 站长 站长日志

灵动标签调用某一天发布的信息,例子如下:

例子1:

[e:loop={1,10,0,0,"FROM_UNIXTIME(newstime,'%Y-%m-%d')='2014-03-03'",''}]
<a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a>
[/e:loop]

此例子可以调用出来2014年3月3日当前发布的信息。

函数:FROM_UNIXTIME
作用:将MYSQL中以INT(11)存储的时间以"YYYY-MM-DD"格式来显示。
语法:FROM_UNIXTIME(unix_timestamp,format)
返回表示 Unix 时间标记的一个字符串,根据format字符串格式化。format可以包含与DATE_FORMAT()函数列出的条目同样的修饰符。
根据format字符串格式化date值。

例子2:

[e:loop={1,10,0,0,'newstime>='.to_time('2014-03-03 00:00:01').' and newstime<='.to_time('2014-03-04 23:59:59'),'newstime DESC'}]
<a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a>
[/e:loop]

此例子可以调用出来2014年3月3日~~2014年3月4日当前发布的信息。

to_time($datetime);//帝国CMS 时间转换函数

例子3:

[e:loop={1,10,0,0,"format_datetime(newstime,'Y-m-d')='2014-03-03'",''}]
<a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a>
[/e:loop]

使用帝国自身的时间转换函数format_datetime
此函数支持把时间戳转换为格式,也支持把时间转换为另外一种格式。

文章评论