the_time( string $format = '' )
Display the time at which the post was written.
Parameters
- $format
-
(string) (Optional) Format to use for retrieving the time the post was written. Accepts 'G', 'U', or PHP date format. Defaults to the 'time_format' option.
Default value: ''
Source
File: wp-includes/general-template.php
function the_time( $format = '' ) { /** * Filters the time a post was written for display. * * @since 0.71 * * @param string $get_the_time The formatted time. * @param string $format Format to use for retrieving the time the post * was written. Accepts 'G', 'U', or PHP date format. */ echo apply_filters( 'the_time', get_the_time( $format ), $format ); }
Expand full source code Collapse full source code View on Trac View on GitHub
Changelog
Version | Description |
---|---|
0.71 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
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().
Basic Example
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 and Time
Displays the date and time.
Example output is:
Posted: July 17, 2007 at 7:19 am