WordPress:Template Tags/the time

来自站长百科
Xxf3325讨论 | 贡献2008年6月25日 (三) 11:27的版本 (新页面: == Description == Displays the time of the current post. This tag must be used within WordPress:The Loop. == Usage == %%% <?php the_time('d'); ?> %%% == Examples == === Default ...)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航、​ 搜索

Description

Displays the time of the current post. This tag must be used within WordPress:The Loop.

Usage

%%% <?php the_time('d'); ?> %%%

Examples

Default Usage

Displays the time using your WordPress defaults.

<p>Time posted: <?php the_time(); ?></p>

Time as AM/PM VS. 24H format

Displays the time using the format parameter string '09:18 am' (ex: 10:36 pm).

<p>Time posted: <?php the_time('g:i a'); ?></p>

--

Displays the time using the 24 hours format parameter string 'G:i' (ex: 17:52).

<p>Time posted: <?php the_time('G:i'); ?></p>

Date as Month Day, Year

Displays the time in the date format 'F j, Y' (ex: December 2, 2004), which could be used to replace the tag the_date().

<div><?php the_time('F j, Y'); ?></div>

Date and Time

Displays the date and time.

<p>Posted: <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?></p>
Posted: July 17, 2007 at 7:19 am

Parameters

d
(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.

Related

模板:Tag Date Tags

模板:Tag Footer