Skip to content

Instantly share code, notes, and snippets.

@omarkdev
Created December 22, 2016 01:39
Show Gist options
  • Save omarkdev/94a25483df44976f358ff6794358110d to your computer and use it in GitHub Desktop.
Save omarkdev/94a25483df44976f358ff6794358110d to your computer and use it in GitHub Desktop.
<?php
namespace Sherlock\Traits;
trait DateTrait {
protected $months = [
'Jan' => 'janeiro',
'Feb' => 'fevereiro',
'Mar' => 'março',
'Apr' => 'abril',
'May' => 'maio',
'Jun' => 'junho',
'Jul' => 'julho',
'Aug' => 'agosto',
'Nov' => 'novembro',
'Sep' => 'setembro',
'Oct' => 'outubro',
'Dec' => 'dezembro'
];
protected function replaceMonths($date)
{
foreach($this->months as $enMonth => $month){
$date = str_replace($month, $enMonth, $date);
}
return $date;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment