Problema de formato de tiempo de PHP
Frecuentes
Visto 107 equipos
0
PHP time format generate different results when spaces included
date('h:i A',strtotime('05:45 AM')); //05:45AM
date('h:i A',strtotime('05 : 45 AM')); // 01:00 AM
Aquí está la resultado
Spaces works in older version of PHP and it is failing in PHP Version above 5.0.5; I wanted to check why this is not allowed with new version
1 Respuestas
1
As stated in the comments, its not a valid time format with the spaces.
Check this resource for strtotime: http://us1.php.net/manual/en/function.strtotime.php
And also check this page for date/time formats: http://us1.php.net/manual/en/datetime.formats.php
contestado el 22 de mayo de 14 a las 14:05
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas php datetime or haz tu propia pregunta.
Spaces are not valid in time formats so if you use them you should expect incorrect results. - John Conde
¿Cuál es tu pregunta? - nl-x
You could however strip out the spaces and luego parse the time using strtotime(). - Fluffeh
because it is not valid time for PHP.It will always show the same time 01:00 AM whatever you enter with space - Bharat Maheshwari
I noted different results showing in time.I wanted confirm this is not a bug in newer version - B L Praveen