More documentation

This commit is contained in:
Antonio de la Rosa 2021-06-01 11:50:24 +02:00
parent c96ed2e491
commit d88139030b
2 changed files with 38 additions and 6 deletions

View file

@ -2,7 +2,10 @@ import time
from datetime import date, datetime, tzinfo
import arrow
# from babel.dates import format_date, format_datetime, format_time, get_timezone, UTC
from settings import config
try:
from settings import config
except:
config={}
#from paramecio.citoplasma.sessions import get_session
from os import environ
@ -147,7 +150,7 @@ def now(utc=False, tz=''):
Args:
utc (bool): If True, the datetime is returned in UTC timezone
tz (str): Timezone name, example: Europe/Madrid. If set the datetime is returned in the timezone selected
tz (str, optional): Timezone name, example: Europe/Madrid. If set the datetime is returned in the timezone selected
Returns:
str: Return actual datetime
@ -174,7 +177,7 @@ def today(utc=False,tz=''):
Args:
utc (bool): If True, the date is returned in UTC timezone
tz (str): Timezone name, example: Europe/Madrid. If set the date is returned in the timezone selected
tz (str, optional): Timezone name, example: Europe/Madrid. If set the date is returned in the timezone selected
Returns:
str: Return actual date with 00:00:00 how time
@ -235,7 +238,7 @@ def timestamp_to_datetime_local(timestamp, tz=''):
Args:
timestamp (int): The timestamp for convert in datetime
tz (str): If you want convert to other timezone, set it.
tz (str, optional): If you want convert to other timezone, set it.
Returns:
@ -287,7 +290,7 @@ def local_to_gmt(timeform, sql_format_time=sql_format_time):
Args:
timeform (str): datetime in YYYYMMDDHHmmss format to convert to new format
sql_format_time (str): by default, the format is YYYYMMDDHHmmss, you can put other formatted str formats for date, here.
sql_format_time (str, optional): by default, the format is YYYYMMDDHHmmss, you can put other formatted str formats for date, here.
Returns:
If timeform is False, return False, if timeform is valid, return the datetime formatted
@ -306,7 +309,7 @@ def gmt_to_local(timeform, sql_format_time=sql_format_time):
Args:
timeform (str): datetime in YYYYMMDDHHmmss format to convert to new format
sql_format_time (str): by default, the format is YYYYMMDDHHmmss, you can put other formatted str formats for date, here.
sql_format_time (str, optional): by default, the format is YYYYMMDDHHmmss, you can put other formatted str formats for date, here.
Returns:
If timeform is False, return False, if timeform is valid, return the datetime formatted