Skip to content
Advertisement

strtotime returns today’s date for a date in wrong format

When I pass ‘7.12.60’ to strtotime, it returns timestamp of today! I know strtotime guesses the format of the given string but here the value is not correct at all! it just returns today’s timestamp:

echo date( 'Y-m-d', strtotime('7.12.60') ); // outputs 2022-01-05!

What i expect is to receive a false or a correct value and not a made up one

Advertisement

Answer

As mentioned in comments of @aynber and others. It was considering it as a time and not a date, I added a time (00:00:00) to the end of the string and now it is returning false.

Thank you very much for your help

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement