import logging
import time


def to_unix_timestamp(text, pattern):
    try:
        return int(time.mktime(time.strptime(text, pattern)) * 1000)
    except Exception as e:
        logging.debug(repr(e))
        return 0
