Skip to content

Instantly share code, notes, and snippets.

@alandbh
Created June 21, 2019 04:51
Show Gist options
  • Save alandbh/a2678dc4a7936e4416bc11f7bf40cbf0 to your computer and use it in GitHub Desktop.
Save alandbh/a2678dc4a7936e4416bc11f7bf40cbf0 to your computer and use it in GitHub Desktop.
Wordpress built-in function to display international dates properly. Retrieve the date in localized format, based on timestamp.
$_evento = get_proximos_eventos(1);
$evento = $_evento[0];
$unixtimestamp_inicio = strtotime($evento['data_inicio']);
echo date_i18n('M', $unixtimestamp_inicio); // Abril
// Depending on your blog settings you will see the date displayed in your local format, for example: 15. november 1976.
echo date_i18n( get_option( 'date_format' ), strtotime( '11/15-1976' ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment