Problema de formato de tiempo de PHP

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

preguntado el 22 de mayo de 14 a las 14:05

Spaces are not valid in time formats so if you use them you should expect incorrect results. -

¿Cuál es tu pregunta? -

You could however strip out the spaces and luego parse the time using strtotime(). -

because it is not valid time for PHP.It will always show the same time 01:00 AM whatever you enter with space -

I noted different results showing in time.I wanted confirm this is not a bug in newer version -

1 Respuestas

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 or haz tu propia pregunta.