Module datetime
Since 2.10.0.
The datetime
module provides support for the datetime and interval data types.
It allows creating the date and time values either via the object interface
or via parsing string values conforming to the ISO-8601 standard.
Below is a list of the datetime
module functions and methods.
Name | Use |
---|---|
datetime.new() | Create a datetime object from a table of time units. |
format() | Convert the standard presentation of a datetime object into a formatted string. |
datetime_object:totable() | Convert the information from a datetime object into the table format. |
set() | Update the field values in the existing datetime object. |
parse() | Convert an input string with the date and time information into a datetime object. |
add() | Modify an existing datetime object by adding values of the input arguments. |
sub() | Modify an existing datetime object by subtracting values of the input arguments. |
datetime.interval.new() | Create an interval object from a table of time units. |
interval_object:totable() | Convert the information from an interval object into the table format. |
Interval arithmetic | Arithmetic operations with datetime and interval objects. |