PHP strtotime returning false for dates less than 1900

前端 未结 2 1142
情话喂你
情话喂你 2021-01-19 18:53

I know this question is very popular

Asked here PHP: strtotime is returning false for a future date? and here How can I work with dates before 1900 in PHP?

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-19 19:11

    You can use gregoriantojd, which has a date range of 4714 B.C. to 9999 A.D. A much wider range than 1900(1970)-2038. If you are trying to calculate date differences, they are close enough. Well, except for the "lost" 10 days October 4-14, 1582. And because of different leap year calculation, you will be off by a day every 100 years.

提交回复
热议问题