date time (tag)

This page contains all the WordPress features for working with dates and time.

Read about what date/time formats exist and how to use them in this articles:

comment_date()

Display the comment date of the current comment.

comment_time()

Display the comment time of the current comment.

current_time()

Retrieve the current time based on specified type.

date_i18n()

Retrieve the date in localized format, based on timestamp.

get_comment_date()

Retrieve the comment date of the current comment.

get_comment_time()

Retrieve the comment time of the current comment.

get_date_from_gmt()

Converts a GMT date into the correct format for the blog.

get_gmt_from_date()

Returns a date in the GMT equivalent.

get_lastpostdate()

Retrieve the date that the last post was published.

get_lastpostmodified()

Get the timestamp of the last time any post was modified.

get_post_time()

Gets the time of the current post creation in the specified format. You can specify a return format (the default is Unix format). Must be used in WordPress loop.

get_post_timestamp()

Retrieves post published or modified time as a Unix timestamp.

get_the_date()

Gets the creation date of the current post. you can specify an arbitrary date output format. Used in a WordPress loop.

get_the_modified_date()

Retrieve the date on which the post was last modified.

get_the_modified_time()

Retrieve the time at which the post was last modified. Works similar to get_the_modified_date().

get_the_time()

Gets the time at which the current post was written in the specified format. Used inside the Loop of WordPress.

get_weekstartend()

Get the week start and end from the datetime or date string from MySQL.

mysql2date()

Convert given date string into a different format.

the_date()

Displays or Retrieve the date of the current post was written. Works with a group of posts (published on the same day).

the_time()

Display the time (date) at which the post was written in the specified format.

wp_checkdate()

Test if the supplied date is valid for the Gregorian calendar.

wp_date()

Retrieves the date, in localized format.

wp_maybe_decline_date()

Determines if the date should be declined.

wp_timezone()

Retrieves the timezone from site settings as a DateTimeZone object.

wp_timezone_choice()

Gives a nicely-formatted list of timezone strings in <option> format for use in <select>.

wp_timezone_string()

Retrieves the timezone from site settings as a string.