Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Arquivo de funções auxiliares
- * @author Alessandro Kobs <contato@kobs.dev>
- * @version 0.1
- * @copyright GPL - 2020, KBS Desenvolvimento
- * @package KbsHelpers
- *
- **/
- if (!function_exists('brDateStringToDate')) {
- function brDateStringToDate($string) {
- /**
- * Converter Data escrita no padrão BR (01 de Janeiro de 2020) para Internacional (01-01-2020)
- * @param String $dateString
- * @return String
- **/
- /**
- * Mantém a relação numérica e textual de meses
- * @name $definedMonths
- * @access private
- **/
- $definedMonths = [
- 'Janeiro' => '01',
- 'Fevereiro' => '02',
- 'Março' => '03',
- 'Abril' => '04',
- 'Maio' => '05',
- 'Junho' => '06',
- 'Julho' => '07',
- 'Agosto' => '08',
- 'Setembro' => '09',
- 'Outubro' => '10',
- 'Novembro' => '11',
- 'Dezembro' => '12'
- ];
- $rawExplode = explode (' de ', $string);
- $rawExplode[1] = $definedMonths[$rawExplode[1]];
- return implode('-',array_reverse($rawExplode));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement