Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rikw's avatar
Level 1

Date field shown as -0001-11-30 00:00:00

Hi,

I have a model and form which I cannot get right. My database fields are of type date and datetime. Both fields are added to the dates array. When I save the form with empty values the database stores as 0000-00-00 00:00:00. But the edit form then shows -0001-11-30 00:00:00. I just cannot get it right. Who can help me?

Cheers! Rik

0 likes
2 replies
miigaa's avatar

I think you should set the date column to be nullable! Then it will be fine.

1 like
rikw's avatar
Level 1

Hi @selmonal, I had that. But submittting an empty field makes it store 0000-00-00 00:00:00 in stead of null. Is that to be expected?

The situation occures when I create a new record with only one field filled. Then the edit screen shows empty date fields. When I submit those fields things go wrong.

2 likes

Please or to participate in this conversation.