WPDev.one
Core Function
View Source on Trac ↗

get_post_time()

get_post_time( mixed $format = 'U', mixed $gmt = false, mixed $post = null, mixed $translate = false )

Retrieves the localized time of the post.

Parameters 2 required

Name / Type Description
string

$format Optional. Format to use for retrieving the time the post was written. Accepts 'G', 'U', or PHP date format. Default 'U'.

Required
$gmt
bool

Optional. Whether to retrieve the GMT time. Default false.

(int

| WP_Post) $post Post ID or post object. Default is global `$post` object.

Required
$translate
bool

Whether to translate the time string. Default false.

Return Value

((string)
(string | int | false) Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. False on failure.

Function Information

Since Version
2.0.0
Source File
wp-includes/general-template.php
Advertisement