Displays the time of the current post. To return the time of a post, use get_the_time(). This tag must be used within The Loop.

the_time() 描述


 <?php the_time$d ); ?> 

the_time() 用法



(string) (可选) The format the time is to display in. Defaults to the time format configured in your WordPress options. See Formatting Date and Time.

默认值: None

the_time() 参数


Default Usage

Displays the time using your WordPress defaults.

Time as AM/PM VS. 24H format

Displays the time using the format parameter string 'g:i a' (ex: 10:36 pm).

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

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

Date and Time

Displays the date and time.

Posted: July 17, 2007 at 7:19 am

the_time() 示例