WordPress:Template Tags/get the time

来自站长百科
Fludlen讨论 | 贡献2008年7月2日 (三) 15:15的版本
跳转至: 导航、​ 搜索

Description

描述

Returns the time of the current post for use in PHP. It does not display the time. This tag must be used within WordPress:The Loop.

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

This tag is available beginning with version 1.5 of WordPress. To display the time of a post, use the_time().

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

Usage

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

用法

%%% <?php 得到_the_时间('格式'); ?> %%%

Examples

Default Usage

例子

默认用法

Returns the time of the current post using the WordPress default format, and displays it using the PHP echo command.

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

<?php echo get_the_time(); ?>

<?php echo 得到_the_时间(); ?>

Assigns Time in Seconds

在很短的时间内指定时间

Assigns the time of the current post in seconds (since January 1 1970, known as the Unix Epoch) to the variable $u_time.

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

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

<?php $u_时间 = 得到_the_时间('U'); ?>

Parameters

参数

format
(string) The format the time is to display in. Defaults to the time format configured in your WordPress options. See WordPress:Formatting Date and Time.
格式
(string)时间显示的格式。默认为WordPress选项中配置的格式。请看看日期和时间格式

Related

See also the_time().

模板:Tag Date Tags

模板:Tag Footer

相关的

也看看the_时间()

模板:标签 日期 标签