WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get post modified time

Description

Retrieve the time at which the post was last modified.

Note: One level »lower« than get_the_modified_time() (← link), but can take more arguments.

Usage

<?php get_post_modified_time$d$gmt$post$translate ); ?>

Parameters

$d
(string) (optional) Specifies the output. Either 'U' for a Unix timestamp, 'G' for a Unix timestamp using GMT, or PHP date format.
Default: U
$gmt
(boolean) (optional) Whether to return the GMT time.
Default: false
$post
(int|object) (optional) Post ID or post object. Defaults to global $post.
Default: null
$translate
(boolean) (optional) If true then the given date and format string will be passed to date_i18n() for translation.
Default: false

Return Values

(string) 
Returns timestamp as specified by $d

Examples

Get a timestamp for the current post:

echo get_post_modified_time(); // 1490121048

Get full date and time in current timezone:

echo get_post_modified_time('F d, Y g:i a'); // "March 21, 2017 12:02 pm"

Get full date and time in UTC:

echo get_post_modified_time('F d, Y g:i a', true); // "March 21, 2017 7:02 pm"

Get full date and time in UTC with localization (as per WordPress settings):

echo get_post_modified_time('F d, Y g:i a', true, null, true); // "März 21, 2017 7:02 pm"

Change Log

Since: 2.0

Source File

get_post_modified_time() is located in wp-includes/general-template.php