PHP Error: A non well formed numeric value encountered

Solución al Error “A non well formed numeric value encountered” en PHP 5.3.2 y usando el Framework Yii 1.1.2

Este error me salio usando PHP 5.3.2 y Framework Yii 1.1.2 en la siguiente linea de mi view:

'value'=> 'date("d-m-Y H:i:s",$data->fecha_inicio)',

y para solucionarlo hay que usar la funcion strtotime de php, quedando aso:

'value'=> 'date("d-m-Y H:i:s",strtotime($data->fecha_fin))',

Si no tienes configurado el “timeZone” en Yii te saldrá un error parecido a este:

strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead

Para configurar el “timeZone” debes ir a tu archivo de configuracion de tu proyecto Yii [protected/config/main.php], debe quedar algo asi:

3
4
5
6
return array(
	'timeZone'=>"America/Monterrey",
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'Cultura UM',

Recuerda usar la funcion strtotime en cada view donde requieras mostrar la fecha.

Related posts:

  1. Error 1329: No data – zero rows fetched, selected, or processed Solución para el error 1329 de MySQL: No data -...

Related posts brought to you by Yet Another Related Posts Plugin.

Deja tu comentario

Todos los comentarios son moderados antes de ser publicados, por lo que no debes escribir en mayusculas o palabras antisonantes.

* Nickname, Email y Comentario requeridos

Mi Perfil

Related Posts

Related posts:

  1. Error 1329: No data – zero rows fetched, selected, or processed Solución para el error 1329 de MySQL: No data -...

Related posts brought to you by Yet Another Related Posts Plugin.