CodeIgniter Forums
Model created_at , updated_at - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Model created_at , updated_at (/showthread.php?tid=78359)



Model created_at , updated_at - pippuccio76 - 01-07-2021

Hi sorry for english , i want know how is the correct way to set model an table about created_at and updated_at .

In table must i set as timestamp or datetime ? in option ?


RE: Model created_at , updated_at - InsiteFX - 01-07-2021

It goes by this.

[b]$dateFormat[/b]

This value works with $useTimestamps and $useSoftDeletes to ensure that the correct type of date value gets inserted into the database. By default, this creates DATETIME values, but valid options are: datetime, date, or int (a PHP timestamp). Using ‘useSoftDeletes’ or ‘useTimestamps’ with an invalid or missing dateFormat will cause an exception.