You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Convert an input string with the date and time information into a ``datetime`` object.
186
+
The input string should be formatted according to one of the following standards:
187
+
188
+
* ISO 8601
189
+
* RFC 3339
190
+
* extended `strftime <https://www.freebsd.org/cgi/man.cgi?query=strftime&sektion=3>`__ -- see description of the :ref:`format() <datetime-format>` for details.
191
+
192
+
:param string input_string: string with the date and time information.
193
+
:param string format: indicator of the input_sting format. Possible values: 'iso8601', 'rfc3339', or ``strptime``-like format string.
194
+
If no value is set, the default formating is used.
195
+
:param number tzoffset: time zone offset from UTC, in minutes.
196
+
197
+
:return: a datetime_object
198
+
:rtype: cdata
199
+
200
+
**Example:**
201
+
202
+
.. code-block:: tarantoolsession
203
+
204
+
tarantool> t = datetime.parse('1970-01-01T00:00:00Z')
205
+
206
+
tarantool> t
207
+
---
208
+
- 1970-01-01T00:00:00Z
209
+
...
210
+
211
+
tarantool> t = datetime.parse('1970-01-01T00:00:00', {format = 'iso8601', tzoffset = 180})
212
+
213
+
tarantool> t
214
+
---
215
+
- 1970-01-01T00:00:00+0300
216
+
...
217
+
218
+
tarantool> t = datetime.parse('2017-12-27T18:45:32.999999-05:00', {format = 'rfc3339'})
219
+
220
+
tarantool> t
221
+
---
222
+
- 2017-12-27T18:45:32.999999-0500
223
+
...
224
+
225
+
tarantool> T = datetime.parse('Thu Jan 1 03:00:00 1970', {format = '%c'})
226
+
227
+
tarantool> T
228
+
---
229
+
- 1970-01-01T03:00:00Z
230
+
...
231
+
232
+
tarantool> T = datetime.parse('12/31/2020', {format = '%m/%d/%y'})
233
+
234
+
tarantool> T
235
+
---
236
+
- 2020-12-31T00:00:00Z
237
+
...
238
+
239
+
tarantool> T = datetime.parse('1970-01-01T03:00:00.125000000+0300', {format = '%FT%T.%f%z'})
0 commit comments