WordPress.org

Ready to get started?Download WordPress

Codex

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

Function Reference/date i18n

Contents

Description

Retrieve the date in localized format, based on timestamp.

If the locale specifies the locale month and weekday, then the locale will take over the format for the date. If it isn't, then the date format string will be used instead.

i18n is an abbreviation for Internationalization. (There are 18 letters between the first "i" and last "n".)

Usage

<?php echo date_i18n$dateformatstring$unixtimestamp$gmt ?>

Parameters

$dateformatstring
(string) (required) Format to display the date.
Default: None
$unixtimestamp
(integer) (optional) Unix timestamp.
Default: false
$gmt
(boolean) (optional) Whether to convert to GMT for time.
Default: false

Return Values

(string) 
The date, translated if locale specifies it.

Examples

Depending on your blog settings you will see the date displayed in your local format, for example: 15. november 1976.

 <?php echo date_i18n( get_option( 'date_format' ), strtotime( '11/15-1976' ) ); ?>

Notes

Change Log

  • Since: 0.71

Source File

date_i18n() is located in wp-includes/functions.php.

Related

L10n: translate(), __(), _e(), _n(), _x(), _ex(), _nx(), esc_attr__(), esc_attr_e(), esc_attr_x(), esc_html__(), esc_html_e(), esc_html_x(), _n_noop(), _nx_noop(), translate_nooped_plural()

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