back-end/utils/export_collection_data_module.py
def datetime_limits_of_month(utcnow=None, set_year=None, set_month=None):
    """ This function returns the limits, first and last datetime, of the current month based on the current utc
        datetime or a user's selection (year, month)
        @parameters
            utcnow                  (datetime or None)  the datetime be based on. If None then the user must specify the
                                                        next two parameters
            set_year                (int or None)       any year
            set_month               (int or None)       an integer [1-12] that specifies the desired month
        @returns
            first_datetime_of_month (datetime)          the first valid moment of current or specified month in the year
            last_datetime_of_month  (datetime)          the last valid moment of current or specified month in the year
    """

    # user sets the desired month
    if set_year is not None and set_month in range(1, 13):

        number_of_days_in_month = calendar.monthrange(year=set_year, month=set_month)[1]

        first_datetime_of_month = datetime(set_year, set_month, 1, 0, 0, 0)
        last_datetime_of_month = datetime(set_year, set_month, number_of_days_in_month, 23, 59, 59)
        return first_datetime_of_month, last_datetime_of_month

    # function determines the limits based on the utcnow object
    elif utcnow is not None:

        number_of_days_in_month = calendar.monthrange(year=utcnow.year, month=utcnow.month)[1]

        first_datetime_of_month = datetime(utcnow.year, utcnow.month, 1, 0, 0, 0)
        last_datetime_of_month = datetime(utcnow.year, utcnow.month, number_of_days_in_month, 23, 59, 59)
        return first_datetime_of_month, last_datetime_of_month

    # -----------------------------------------------------------------------------------------------------------------#

 This function returns the limits, first and last datetime, of the current month based on the current utc
        datetime or a user's selection (year, month)
        @parameters
            utcnow                  (datetime or None)  the datetime be based on. If None then the user must specify the
                                                        next two parameters
            set_year                (int or None)       any year
            set_month               (int or None)       an integer [1-12] that specifies the desired month
        @returns
            first_datetime_of_month (datetime)          the first valid moment of current or specified month in the year
            last_datetime_of_month  (datetime)          the last valid moment of current or specified month in the year
    
This function returns the limits, first and last datetime, of the current month based on the current utc
datetime or a user's selection (year, month)
@parameters
utcnow                  (datetime or None)  the datetime be based on. If None then the user must specify the
next two parameters
set_year                (int or None)       any year
set_month               (int or None)       an integer [1-12] that specifies the desired month
@returns
first_datetime_of_month (datetime)          the first valid moment of current or specified month in the year
last_datetime_of_month  (datetime)          the last valid moment of current or specified month in the year
This function returns the limits first and last datetime of the current month based on the current utc datetime or a user ' s selection ( year month ) @parameters utcnow ( datetime or None ) the datetime be based on . If None then the user must specify the next two parameters set_year ( int or None ) any year set_month ( int or None ) an integer [ 1 - 12 ] that specifies the desired month @returns first_datetime_of_month ( datetime ) the first valid moment of current or specified month in the year last_datetime_of_month ( datetime ) the last valid moment of current or specified month in the year
def datetime_limits_of_month(utcnow=None, set_year=None, set_month=None):
    if set_year is not None and set_month in range(1, 13):
        number_of_days_in_month = calendar.monthrange(year=set_year, month=set_month)[1]
        first_datetime_of_month = datetime(set_year, set_month, 1, 0, 0, 0)
        last_datetime_of_month = datetime(set_year, set_month, number_of_days_in_month, 23, 59, 59)
        return first_datetime_of_month, last_datetime_of_month
    elif utcnow is not None:
        number_of_days_in_month = calendar.monthrange(year=utcnow.year, month=utcnow.month)[1]
        first_datetime_of_month = datetime(utcnow.year, utcnow.month, 1, 0, 0, 0)
        last_datetime_of_month = datetime(utcnow.year, utcnow.month, number_of_days_in_month, 23, 59, 59)
        return first_datetime_of_month, last_datetime_of_month
def datetime_limits_of_month ( utcnow = None , set_year = None , set_month = None ) : if set_year is not None and set_month in range ( 1 , 13 ) : number_of_days_in_month = calendar . monthrange ( year = set_year , month = set_month ) [ 1 ] first_datetime_of_month = datetime ( set_year , set_month , 1 , 0 , 0 , 0 ) last_datetime_of_month = datetime ( set_year , set_month , number_of_days_in_month , 23 , 59 , 59 ) return first_datetime_of_month , last_datetime_of_month elif utcnow is not None : number_of_days_in_month = calendar . monthrange ( year = utcnow . year , month = utcnow . month ) [ 1 ] first_datetime_of_month = datetime ( utcnow . year , utcnow . month , 1 , 0 , 0 , 0 ) last_datetime_of_month = datetime ( utcnow . year , utcnow . month , number_of_days_in_month , 23 , 59 , 59 ) return first_datetime_of_month , last_datetime_of_month
This function returns the limits, first and last datetime, of the current month based on the current utc
datetime or a user's selection (year, month)
@parameters
utcnow                  (datetime or None)  the datetime be based on.
This function returns the limits first and last datetime of the current month based on the current utc datetime or a user ' s selection ( year month ) @parameters utcnow ( datetime or None ) the datetime be based on .
""" This function returns the limits, first and last datetime, of the current month based on the current utc
        datetime or a user's selection (year, month)
        @parameters
            utcnow                  (datetime or None)  the datetime be based on. If None then the user must specify the
                                                        next two parameters
            set_year                (int or None)       any year
            set_month               (int or None)       an integer [1-12] that specifies the desired month
        @returns
            first_datetime_of_month (datetime)          the first valid moment of current or specified month in the year
            last_datetime_of_month  (datetime)          the last valid moment of current or specified month in the year
    """ # user sets the desired month
 # function determines the limits based on the utcnow object
 # -----------------------------------------------------------------------------------------------------------------#

utcnow
set_year
set_month