the_modified_time( string $d = '' )

Display the time at which the post was last modified.


Description Description


Parameters Parameters

$d

(string) (Optional) Either 'G', 'U', or php date format defaults to the value specified in the time_format option.

Default value: ''


Top ↑

Source Source

File: wp-includes/general-template.php

function the_modified_time($d = '') {
	/**
	 * Filters the localized time a post was last modified, for display.
	 *
	 * @since 2.0.0
	 *
	 * @param string $get_the_modified_time The formatted time.
	 * @param string $d                     The time format. Accepts 'G', 'U',
	 *                                      or php date format. Defaults to value
	 *                                      specified in 'time_format' option.
	 */
	echo apply_filters( 'the_modified_time', get_the_modified_time($d), $d );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note content
    Contributed by Codex

    Time in the 12-hour format (am/pm)
    If a post was modified at 10:36pm, this example displays the time the post was last modified using the 12-hour format parameter string ‘g:i a’.

    <p>Time last modified: <?php the_modified_time('g:i a'); ?></p>
    

    Output is “Time last modified: 10:36 pm”

  2. Skip to note content
    Contributed by Codex

    Time in the 24-hour format

    If a post was modified at 10:36pm, this example displays the time the post was last modified using the 24-hour format parameter string ‘G:i’.

    <p>Time last modified: <?php the_modified_time('G:i'); ?></p>
    

    Output is “Time last modified: 22:36”

  3. Skip to note content
    Contributed by Codex
    Date as Month Day, Year

    Displays the last modified time and date in the date format ‘F j, Y’ (ex: December 2, 2006), which could be used to replace the tag the_modified_date().

    <div>Last modified: <?php the_modified_time('F j, Y'); ?></div>
    

    Output is “Last modified: December 2, 2006”.

  4. Skip to note content
    Contributed by Codex

    Date as Month Day, Year

    Displays the last modified time and date in the date format ‘F j, Y’ (ex: December 2, 2006), which could be used to replace the tag the_modified_date().

    <div>Last modified: <?php the_modified_time('F j, Y'); ?></div>
    

    Output is “Last modified: December 2, 2006”.

You must log in before being able to contribute a note or feedback.