Codex

Function Reference/get the time

Contents

Description

Returns the time of the current post for use in PHP. It does not display the time. To display the time of a post, use the_time(). This tag must be used within The Loop.

Usage

 <?php get_the_time$d ); ?> 

Parameters

$d
(string) (optional) The format the date is to display in. Defaults to the date format configured in your WordPress options. See Formatting Date and Time.
Default: F j, Y

Examples

Default Usage

Returns the time of the current post using the WordPress default format, and displays it using the PHP echo command.

<?php echo get_the_time(); ?>

Assigns Time in Seconds

Assigns the time of the current post in seconds (since January 1 1970, known as the Unix Epoch) to the variable $u_time.

<?php $u_time = get_the_time('U'); ?>

Change Log

Since: 1.5.0

Related

the_time, the_date, the_date_xml, the_modified_time, the_modified_date, the_modified_author, single_month_title, get_the_time, get_day_link, get_month_link, get_year_link, get_calendar

See also index of Function Reference and index of Template Tags.