WordPress: Template Tags/get the time:修订间差异
(新页面: == 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. This...) |
无编辑摘要 |
||
第1行: | 第1行: | ||
== Description == | == Description == | ||
==描述 == | |||
Returns the time of the current post for use in [[WordPress:Glossary#PHP|PHP]]. It does not display the time. This tag must be used within [[WordPress:The Loop]]. | Returns the time of the current post for use in [[WordPress:Glossary#PHP|PHP]]. It does not display the time. This tag must be used within [[WordPress:The Loop]]. | ||
返回当前文章发表的时间,用在[[WordPress:Glossary#PHP|PHP]]中。PHP不显示时间。必须在[[WordPress:The Loop|The Loop]]内使用这个标签。 | |||
This tag is available beginning with version 1.5 of WordPress. To display the time of a post, use [[WordPress:Template Tags/the time|the_time()]]. | This tag is available beginning with version 1.5 of WordPress. To display the time of a post, use [[WordPress:Template Tags/the time|the_time()]]. | ||
从WordPress1.5版本开始,就有这个标签。要显示一篇文章的发表时间,请使用[[WordPress:Template Tags/the time|the_时间()]]。 | |||
== Usage == | == Usage == | ||
%%% <?php get_the_time('format'); ?> %%% | %%% <?php get_the_time('format'); ?> %%% | ||
== 用法 == | |||
%%% <?php 得到_the_时间('格式'); ?> %%% | |||
== Examples == | == Examples == | ||
=== Default Usage === | === Default Usage === | ||
== 例子 == | |||
=== 默认用法 === | |||
Returns the time of the current post using the WordPress default format, and displays it using the [[WordPress:Glossary#PHP|PHP]] echo command. | Returns the time of the current post using the WordPress default format, and displays it using the [[WordPress:Glossary#PHP|PHP]] echo command. | ||
使用WordPress默认格式,返回当前文章的发表时间,并且使用[[WordPress:Glossary#PHP|PHP]] echo 命令,显示时间。 | |||
<?php echo get_the_time(); ?> | <?php echo get_the_time(); ?> | ||
<?php echo 得到_the_时间(); ?> | |||
=== Assigns Time in Seconds === | === Assigns Time in Seconds === | ||
=== 在很短的时间内指定时间 === | |||
Assigns the time of the current post in seconds (since January 1 1970, known as the [[WordPress:Glossary#Unix|Unix]] Epoch) to the variable $u_time. | Assigns the time of the current post in seconds (since January 1 1970, known as the [[WordPress:Glossary#Unix|Unix]] Epoch) to the variable $u_time. | ||
在很多的时间内,将当前文章的发表时间(从1970年1月1日起, [[WordPress:Glossary#Unix|Unix]] Epoch)指定到变数 $u_时间。 | |||
<?php $u_time = get_the_time('U'); ?> | <?php $u_time = get_the_time('U'); ?> | ||
<?php $u_时间 = 得到_the_时间('U'); ?> | |||
== Parameters == | == 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]]. | ; 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选项中配置的格式。请看看[[WordPress:Formatting Date and Time|日期和时间格式]]。 | |||
== Related == | == Related == | ||
第34行: | 第61行: | ||
{{Tag Footer}} | {{Tag Footer}} | ||
== 相关的 == | |||
也看看[[WordPress:Template Tags/the time|the_时间()]]。 | |||
{{标签 日期 标签}} | |||
{{标签 页底文字}} |
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().
相关的
也看看the_时间()。