Skip to content

Commit d38f1f2

Browse files
committed
docs: add user guide
1 parent 381132d commit d38f1f2

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

user_guide_src/source/changelogs/v4.5.0.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ not changed.
317317

318318
See :ref:`Using CodeIgniter’s Model <model-update-only-changed>` for details.
319319

320+
Saving Dates
321+
------------
322+
323+
Now you can configure the date/time format when you save :doc:`Time <../libraries/time>`
324+
instances. See :ref:`model-saving-dates` for details.
325+
320326
Libraries
321327
=========
322328

user_guide_src/source/database/configuration.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ Explanation of Values:
191191
* ``datetime-us`` - date and time with microsecond format
192192
* ``time`` - time format
193193
This can be used since v4.5.0, and you can get the value, e.g., ``$db->dateFormat['datetime']``.
194-
Currently, the database drivers do not use these values directly, but just provide the values.
194+
Currently, the database drivers do not use these values directly,
195+
but :ref:`Model <model-saving-dates>` uses them.
195196
================ ===========================================================================================================
196197

197198
.. _DateTime format: https://www.php.net/manual/en/datetime.format.php

user_guide_src/source/models/model.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,21 @@ model's ``save()`` method to inspect the class, grab any public and private prop
458458
.. note:: If you find yourself working with Entities a lot, CodeIgniter provides a built-in :doc:`Entity class </models/entities>`
459459
that provides several handy features that make developing Entities simpler.
460460

461+
.. _model-saving-dates:
462+
463+
Saving Dates
464+
------------
465+
466+
.. versionadded:: 4.5.0
467+
468+
When saving data, if you pass :doc:`Time <../libraries/time>` instances, they are
469+
converted to strings with the format defined in ``dateFormat['datetime']`` and
470+
``dateFormat['date']`` in the
471+
:ref:`database configuration <database-config-explanation-of-values>`.
472+
473+
.. note:: Prior to v4.5.0, the date/time formats were hard coded as ``Y-m-d H:i:s``
474+
and ``Y-m-d`` in the Model class.
475+
461476
Deleting Data
462477
=============
463478

0 commit comments

Comments
 (0)