We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

luman on 06/29/06


Tagged

date format


Versions (?)


Who likes this?

5 people have marked this snippet as a favorite

daniel
arcturus
alexsancho
sendoa
willcodeforfood


Fecha en castellano


Published in: PHP 


  1. function datacastella($data = '', $separator) {
  2. static $mes = array('', 'enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre');
  3. if ($data == '') $data = time();
  4. if ((int)$data > 9999) $data = date('Y-m-d', $data);
  5. list($a,$m,$d) = explode('-', $data);
  6. $d = (int)$d;
  7. $m = (int)$m;
  8. return $d.$separator.$m.$separator.$a;
  9. }

Report this snippet 

You need to login to post a comment.