Bigbob556677
Bigbob556677

Reputation: 2158

strtotime returns false for large dates php5.6

In my php5.6 the output of the following code is false

$test =  strtotime("2050-07-31 00:00:00.000000");

when running this code using the online compiler attached below it returns 2542838400

https://www.w3schools.com/php/phptryit.asp?filename=tryphp_compiler

What would cause this code to be returning false for us and how would we go about fixing this?

Upvotes: 0

Views: 59

Answers (1)

u_mulder
u_mulder

Reputation: 54841

In addition to many other reasons why strtotime returns false, there can be another one - you have 32-bit computing system.

Which means that values that are greater than 2 147 483 647 (and 2 542 838 400 is) cannot be stored in a variable.

So, you have to check your architecture and move to 64-bit computing system.

Upvotes: 1

Related Questions