PHP date showing '1970-01-01 ' after conversion

前端 未结 8 623
醉话见心
醉话见心 2020-12-04 16:44

I have a form in which date format is dd/mm/yyyy . For searching database , I hanverted the date format to yyyy-mm-dd . But when I echo

8条回答
  •  囚心锁ツ
    2020-12-04 17:28

    January 1, 1970 is the so called Unix epoch. It's the date where they started counting the Unix time. If you get this date as a return value, it usually means that the conversion of your date to the Unix timestamp returned a (near-) zero result. So the date conversion doesn't succeed. Most likely because it receives a wrong input.

    In other words, your strtotime($date1) returns 0, meaning that $date1 is passed in an unsupported format for the strtotime function.

提交回复
热议问题