Skip to content

Commit 82f5cfe

Browse files
committed
Update description and examples of the datetime object methods
Part of #2411
1 parent 82dbe1b commit 82f5cfe

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

doc/reference/reference_lua/datetime.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Module datetime
44

55
Since :doc:`2.10.0 </release/2.10.0>`.
66

7-
The ``datetime`` module provides support of the timestamp and interval data types. [TDB -- links].
8-
It allows to create the date and timestamp values using either object interface,
9-
or via parsing the string values conforming to ISO-8601 standard.
7+
The ``datetime`` module provides support for the :ref:`datetime and interval data types <index-box_datetime>`.
8+
It allows creating the date and time values either via the object interface
9+
or via parsing string values conforming to the ISO-8601 standard.
1010

1111
Below is a list of the ``datetime`` module functions and methods.
1212

@@ -23,16 +23,16 @@ Below is a list of the ``datetime`` module functions and methods.
2323
- Use
2424

2525
* - :doc:`./datetime/new`
26-
- Create a datetime object from a table of date and time values/parameters
26+
- Create a ``datetime`` object from a table of time units
2727

2828
* - :ref:`format() <datetime-format>`
29-
- Convert a datetime object into a string of a particular format
29+
- Convert the standard presentation of a ``datetime`` object into a formatted string
3030

3131
* - :ref:`totable() <datetime-totable>`
32-
- Convert a datetime object into a Lua table
32+
- Convert the information from a ``datetime`` object into the table format
3333

3434
* - :ref:`set() <datetime-set>`
35-
- Update the field values in the existing datetime object
35+
- Update the field values in the existing ``datetime`` object
3636

3737

3838

doc/reference/reference_lua/datetime/datetime_object.rst

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ datetime_object
5656
* - tzoffset
5757
- Time zone offset from UTC
5858

59-
:return: table with the date and time parameters [TBD]
59+
:return: table with the date and time parameters [TBD - description]
6060
:rtype: table
6161

6262
**Example:**
@@ -95,12 +95,13 @@ datetime_object
9595
.. method:: format( ['convension_specifications'] )
9696

9797
Convert the standard ``datetime`` object presentation into a formatted string.
98-
The convension specifications are the same as in the `FreeBSD strftime <https://www.freebsd.org/cgi/man.cgi?query=strftime&sektion=3>`__.
99-
Additional convension for nanoseconds is `%f` which also allows the modifier to control the output precision of fractional part (see example below).
98+
The formatting convension specifications are the same as in the `FreeBSD strftime <https://www.freebsd.org/cgi/man.cgi?query=strftime&sektion=3>`__.
99+
Additional convension for nanoseconds is `%f` which also allows a modifier to control the output precision of fractional part: `%5f` (see the example below).
100+
If no arguments are set for the method, the default convensions are used: `'%FT%T.%f%z'` (see the example below).
100101

101-
:param string convension_specifications: [TBD]
102+
:param string convension_specifications: string consisting of zero or more conversion specifications and ordinary characters
102103

103-
:return: string with the formatted date and time information [TBD]
104+
:return: string with the formatted date and time information
104105
:rtype: string
105106

106107
**Example:**
@@ -128,6 +129,16 @@ datetime_object
128129
- 20.08.21 18:25:20.12345
129130
...
130131
132+
tarantool> dt:format()
133+
---
134+
- 2021-08-20T18:25:20.123456789+0300
135+
...
136+
137+
tarantool> dt:format('%FT%T.%f%z')
138+
---
139+
- 2021-08-20T18:25:20.123456789+0300
140+
...
141+
131142
.. _datetime-set:
132143

133144
.. method:: set( [{ time_units }] )
@@ -165,4 +176,4 @@ datetime_object
165176
tarantool> dt:set {tzoffset = 60}
166177
---
167178
- 2021-08-20T18:25:20.567+0100
168-
...
179+
...

0 commit comments

Comments
 (0)