import time


def timestamp_to_datetime(timestamp, formatter="%Y-%m-%d %H:%M:%S"):
    """ timestamp格式化为datetime

    :参数 timestamp: 精确到秒的timestamp时间
    :参数 formatter: 格式化后的时间格式，默认: %Y-%m-%d %H:%M:%S
    :返回: CST时间
    """

    ltime = time.localtime(timestamp)
    timeStr = time.strftime(formatter, ltime)
    return timeStr