Php - Días y meses en español


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function getDia( $timestamp = 0 ){
  2. $timestamp = $timestamp == 0 ? time() : $timestamp;
  3. $dias = array('Domingo','Lunes','Martes','Miercoles','Jueves','Viernes','Sábado');
  4. return $dias[date("w", $timestamp)];
  5. }
  6.  
  7. function getMes( $timestamp = 0 ){
  8. $timestamp = $timestamp == 0 ? time() : $timestamp;
  9. $meses = array('','Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre');
  10. return $meses[date("n", $timestamp)];
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.