I bought some systems but all of them come with date fields in English, as well as the American standard: year / month / day.
How do I convert to day / month / year format?
I bought some systems but all of them come with date fields in English, as well as the American standard: year / month / day.
How do I convert to day / month / year format?
<?php
echo date('Y/m/d'); // retorna a data nesse formato ano/mês/dia, essa data é a atual do servidor você pode alterar da forma que desejar exemplo date('d-m-Y')
echo date('d/m/Y', strtotime($variavel)); // convert a data da $variavel para o formato dia/mês/ano
?>
I advise you to use notepadd ++ or dreamweaver to search the files, so you search where you have date, date, $ date something like this until you find and use the second option you convert to our most common format
Maybe you can use locale
.
Here's an example:
<?php
/* Define o local para Holandês(usar pt_BR para o Português(Brasil) ) */
setlocale (LC_ALL, 'nl_NL');
/* Mostra: vrijdag 22 december 1978 */
echo strftime ("%A %e %B %Y", mktime (0, 0, 0, 12, 22, 1978));
/* Tenta diferentes nomes de local para o Alemão apartir do PHP 4.3.0 */
$loc_de = setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
echo "Preferred locale for german on this system is '$loc_de'";
?>
References:
You can use a set of functions as follows:
Moving from the American format to the Brazilian format:
implode('/', array_reverse(explode('-', $data)));
E Moving from the Brazilian format to the American format:
implode('-', array_reverse(explode('/', $data)));
Links:
explode (): link
implode (): link
array_reverse (): link
To convert dates from any format that date comes, you can use the native DateTime PHP class.
See an example:
<?php
$data = '2014/07/17';
$data_brasil = DateTime::createFromFormat('Y/m/d', $data);
print_r($data_brasil->format('d/m/Y')); //17/07/2014