WordPress:Template Tags/get the time

来自站长百科
跳转至: 导航、​ 搜索

描述[ ]

返回当前文章发表的时间,用在PHP中。PHP不显示时间。必须在The Loop内使用这个标签。

从WordPress1.5版本开始,就有这个标签。要显示一篇文章的发表时间,请使用the_time()

用法[ ]

%%% <?php get_the_time('format'); ?> %%%

例子[ ]

默认用法[ ]

使用WordPress默认格式,返回当前文章的发表时间,并且使用PHP echo 命令,显示时间。

<?php echo get_the_time(); ?>

在很短的时间内指定时间[ ]

在很多的时间内,将当前文章的发表时间(从1970年1月1日起, Unix Epoch)指定到变数 $u_时间。

<?php $u_time = get_the_time('U'); ?>

参数[ ]

格式
(string)时间显示的格式。默认为WordPress选项中配置的格式。请看看日期和时间格式

相关的[ ]

也看看the_time()

模板:标签 日期 标签