|
Terarea
2
The automation project
|

Public Member Functions | |
| None | __init__ (self, bool debug=False) |
| str | datetime_to_string (self, datetime datetime_instance, bool date_only=False, bool sql_mode=False) |
| str | string_to_datetime (self, str datetime_string_instance, bool date_only=False) |
| str | get_correct_now_value (self) |
| str | get_correct_current_date_value (self) |
Data Fields | |
| bool | debug = debug |
| str | date_only = SCONST.DATE_ONLY |
| str | date_and_time = SCONST.DATE_AND_TIME |
| Disp | disp |
_summary_
Definition at line 12 of file sql_time_manipulation.py.
| None src.lib.sql.sql_time_manipulation.SQLTimeManipulation.__init__ | ( | self, | |
| bool | debug = False ) |
_summary_
This is the class that contains functions in charge of manipulating time.
It can convert time from as string to a datetime and vice-versa
Args:
debug (bool, optional): _description_. Defaults to False.
Definition at line 16 of file sql_time_manipulation.py.
| str src.lib.sql.sql_time_manipulation.SQLTimeManipulation.datetime_to_string | ( | self, | |
| datetime | datetime_instance, | ||
| bool | date_only = False, | ||
| bool | sql_mode = False ) |
_summary_
Convert a datetime instance to a string.
Args:
datetime_instance (datetime): _description_: The datetime item
date_only (bool, optional): _description_. Defaults to False.: if True will only return the date section, otherwise will return the date and time section.
sql_mode (bool, optional): _description_. Defaults to False.: if True, will add the microseconds to the response so that it can be directly inserted into an sql command.
Raises:
ValueError: _description_: If the datetime instance is not a datetime, a valueerror is raised.
Returns:
str: _description_: A string instance of the datetime.
Definition at line 37 of file sql_time_manipulation.py.
| str src.lib.sql.sql_time_manipulation.SQLTimeManipulation.get_correct_current_date_value | ( | self | ) |
_summary_
Get the current date and time in the correct format for the database.
Returns:
str: _description_
Definition at line 104 of file sql_time_manipulation.py.
| str src.lib.sql.sql_time_manipulation.SQLTimeManipulation.get_correct_now_value | ( | self | ) |
_summary_
Get the current date and time in the correct format for the database.
Returns:
str: _description_
Definition at line 94 of file sql_time_manipulation.py.
| str src.lib.sql.sql_time_manipulation.SQLTimeManipulation.string_to_datetime | ( | self, | |
| str | datetime_string_instance, | ||
| bool | date_only = False ) |
_summary_
Convert a datetime instance to a string.
Args:
datetime_string_instance (str): _description_: The string datetime item
date_only (bool, optional): _description_. Defaults to False.: if True will only return the date section, otherwise will return the date and time section.
Raises:
ValueError: _description_: If the datetime instance is not a datetime, a valueerror is raised.
Returns:
str: _description_: A string instance of the datetime.
Definition at line 69 of file sql_time_manipulation.py.
| src.lib.sql.sql_time_manipulation.SQLTimeManipulation.date_and_time = SCONST.DATE_AND_TIME |
Definition at line 27 of file sql_time_manipulation.py.
| src.lib.sql.sql_time_manipulation.SQLTimeManipulation.date_only = SCONST.DATE_ONLY |
Definition at line 26 of file sql_time_manipulation.py.
| bool src.lib.sql.sql_time_manipulation.SQLTimeManipulation.debug = debug |
Definition at line 24 of file sql_time_manipulation.py.
| Disp src.lib.sql.sql_time_manipulation.SQLTimeManipulation.disp |
Definition at line 29 of file sql_time_manipulation.py.