Skip to content

Instantly share code, notes, and snippets.

@lunks
Created March 13, 2010 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lunks/331583 to your computer and use it in GitHub Desktop.
Save lunks/331583 to your computer and use it in GitHub Desktop.
<?php
/**
* Description of data.class
*
* @author Pedro
*/
class Data {
function b($date){
return implode("-", array_reverse(explode("/", $date)));
}
function m($date){
return implode("/", array_reverse(explode("-", $date)));
}
function agora(){
return date("d/m/Y");
}
function agoraBanco(){
return date("Y-m-d");
}
function extenso($date){
if (!$date) return false;
$a = explode("/",$date);
switch ($a[1]) {
case '01':
$a[1] = "Janeiro";
break;
case '02':
$a[1] = "Fevereiro";
break;
case '03':
$a[1] = "Março";
break;
case '04':
$a[1] = "Abril";
break;
case '09':
$a[1] = "Setembro";
break;
default:
break;
}
return $a[0]." de ".$a[1]." de ".$a[2];
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment