In advance, I read this question:
How to prevent PHP from converting a DateTime object with a value of 0000-00-00 to a value of -0001-11-30
But I donβt get why 0000-00-00 00:00:00 changes to -0001-11-30 00:00:00 when I run this code:
$date = date_create('0000-00-00 00:00:00'); echo date_format($date, 'Ymd H:i:s');
When I try it with 0001-00-00 00:00:00, I get:
0000-11-30 00:00:00
and from 0001-01-01 00:00:00 I get:
0001-01-01 00:00:00
and from 0000-00-01 00:00:00:
-0001-12-01 00:00:00
Is there any specific reason why it always amounts to a year / day / month before the date of absence?
Is there something wrong with the date_create or date_format functions ?
I notice that the time is displayed correctly and probably because there is a time 00:00:00.
date php
Loko
source share