WordPress the_modified_time() Function

Definition
In WordPress, the_modified_time() prints the time of day when a post was last edited. For example, 9:45 am.
Pair it with the_modified_date() to show both the date and the time of the last change.
Syntax
A few ways to call the_modified_time().
<p>Edited at <?php the_modified_time(); ?></p>
| Call | What it does |
|---|
the_modified_time() | Print the time in the site format. |
the_modified_time( 'g:i a' ) | Print the time in your own format. |
the_modified_time( 'F j, Y' ) | You can also print a date with it. |
get_the_modified_time() | Return the time as a string. |
It prints the modified time. The default format comes from Settings > General.
Full declaration
the_modified_time( string $format = '' ): void
Parameters
| Parameter | Description |
|---|
$format | string. A PHP date format. Default is the site time format. |
Return Value
| Return Value | Description |
|---|
| void | Nothing is returned. The time is printed. |
WordPress Examples
Three short examples. Each one shows the code and what it prints.
Example 1 — Print the time
Print the time with the default format.
<p>Edited at <?php the_modified_time(); ?></p>
How It Works
the_modified_time() prints the time of the last edit.- The default format is the one set in Settings > General.
- The sentence around it is ours.
Example 2 — Use a 24 hour format
Pass a PHP format to change how the time looks.
<p>Edited at <?php the_modified_time( 'H:i' ); ?></p>
How It Works
H is the hour with 24 hour format.i is the minutes.- You can change the look any time with a new format.
Example 3 — Date and time together
Use it with the modified date.
<p>
Updated on <?php the_modified_date( 'F j, Y' ); ?>
at <?php the_modified_time( 'g:i a' ); ?>
</p>
<p>
Updated on November 12, 2026
at 9:45 am
</p>
How It Works
the_modified_date() prints the date.the_modified_time() prints the time.- Together they show exactly when the post changed.
Frequently Asked Questions
It prints the time of day when the post was last edited.
Pass a PHP date format as the first argument, for example g:i a.
Use get_the_modified_time().
Check the time zone in Settings > General.
Use the_modified_date().
Browse all post functions
Open the functions index for simple guides with examples and FAQs.
Post Functions Index →About the author
Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
8 people found this page helpful