B L Praveen
B L Praveen

Reputation: 1990

PHP Time Format Issue

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

Here is the result

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

Upvotes: 0

Views: 115

Answers (1)

JustinM151
JustinM151

Reputation: 744

As stated in the comments, its not a valid time format with the spaces.

Check this resource for strtotime: https://www.php.net/manual/en/function.strtotime.php

And also check this page for date/time formats: https://www.php.net/manual/en/datetime.formats.php

Upvotes: 1

Related Questions