Hello, teachers and classmates.
During development, automatic timestamps were turned on. During template output, it was found that conventional automatic timestamp conversion failed.
Later put it in the database.
'datetime_format' => 'Y-m-d H:i:s', after changing this option to false, the normal conversion in the template still fails.
Please tell me how to output correctly.
Due to the rules of the framework, the timestamp writing function is automatically enabled. You need to get the timestamp through the getter in the model, and then format the time in the getter. Just call this field directly when calling it in the template.
Use the getter in the model to get it. Format and return.
Directly output in the template
Note: Turn on automatic timestamp writing. Generally, the timestamp written through the model method can take effect normally. When reading, data is also obtained through the model. The time displayed on the front desk can be converted normally.
Write directly in native form, <?php date('Y-m-d H:i:s',time());?>