Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/11/2010, 16:59
minoyo
 
Fecha de Ingreso: octubre-2010
Mensajes: 27
Antigüedad: 13 años, 6 meses
Puntos: 0
Pregunta PROBLEMAS al obtener Dia/Mes/Año de un date

Hola todos!!

vereis, he estado mirando algun tema abierto relacionado con mi problema pero no logro resolverlo.
Quiero obtener el dia, el mes y el año de una variable $fecha (2010-11-22).
Uso la funcion date tal como:
$day = date('d',$fecha);
$month = date('m',$fecha);
$year = date('Y',$fecha);

pero el resultado que obtengo es:
$day = 1
$month = 1
$year = 1970
Me sale la primera fecha por defecto!...

Os escribo mi codigo:

$sdate = JRequest::getVar('sdate');
$s_hour = (int) JRequest::getVar('s_hour');
$s_min = (int) JRequest::getVar('s_minute');
$edate = JRequest::getVar('edate');
$e_hour = (int) JRequest::getVar('e_hour');
$e_min = (int) JRequest::getVar('e_minute');
$title = $this->_db->Quote(JRequest::getVar('title'));
$project = $this->_db->Quote((int)$this->_session->getParameter('workspace'));
$user = $this->_session->getUser();
$now = $this->_db->Quote(time());

$new_sdate = $this->_db->Quote($sdate);
$new_edate = $this->_db->Quote($edate);

$day = $this->_db->Quote(date('d',$sdate));
$month = $this->_db->Quote(date('m',$sdate));
$year = $this->_db->Quote(date('Y',$sdate));

* Si pruebo con $sdate... me sale el resultado anterior...
* Si pruebo con $new_sdate... me sale error...

que puede ser???....
Alguien sabe donde esta el problema??

Muchas gracias!!