import time


def date_to_TS(date, format='%y-%m-%d %H:%M:%S'):
    """ Convert date to timestamp.

    Parameters
    ----------
    date : int, str or date
        Date to convert to timestamp
    format : str
        Format of input date.

    Return
    ------
    int
        Timestamp of the date.

    """
    if isinstance(date, int):

        return date

    elif isinstance(date, str):

        return time.mktime(time.strptime(date, format))

    else:
        print('Date format not allowed')

        raise ValueError('Unknow format', type(date))