Skip to content

Commit

Permalink
docs: add user guide
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Feb 13, 2024
1 parent 381132d commit d38f1f2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
6 changes: 6 additions & 0 deletions user_guide_src/source/changelogs/v4.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ not changed.

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

Saving Dates
------------

Now you can configure the date/time format when you save :doc:`Time <../libraries/time>`
instances. See :ref:`model-saving-dates` for details.

Libraries
=========

Expand Down
3 changes: 2 additions & 1 deletion user_guide_src/source/database/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ Explanation of Values:
* ``datetime-us`` - date and time with microsecond format
* ``time`` - time format
This can be used since v4.5.0, and you can get the value, e.g., ``$db->dateFormat['datetime']``.
Currently, the database drivers do not use these values directly, but just provide the values.
Currently, the database drivers do not use these values directly,
but :ref:`Model <model-saving-dates>` uses them.
================ ===========================================================================================================

.. _DateTime format: https://www.php.net/manual/en/datetime.format.php
Expand Down
15 changes: 15 additions & 0 deletions user_guide_src/source/models/model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,21 @@ model's ``save()`` method to inspect the class, grab any public and private prop
.. note:: If you find yourself working with Entities a lot, CodeIgniter provides a built-in :doc:`Entity class </models/entities>`
that provides several handy features that make developing Entities simpler.

.. _model-saving-dates:

Saving Dates
------------

.. versionadded:: 4.5.0

When saving data, if you pass :doc:`Time <../libraries/time>` instances, they are
converted to strings with the format defined in ``dateFormat['datetime']`` and
``dateFormat['date']`` in the
:ref:`database configuration <database-config-explanation-of-values>`.

.. note:: Prior to v4.5.0, the date/time formats were hard coded as ``Y-m-d H:i:s``
and ``Y-m-d`` in the Model class.

Deleting Data
=============

Expand Down

0 comments on commit d38f1f2

Please sign in to comment.