Exemplo n.º 1
0
def format_datetime(value):
    if value is None:
        return ""

    now_timestamp = time.time()
    offset = datetime.fromtimestamp(now_timestamp) - datetime.utcfromtimestamp(
        now_timestamp)
    result = datetime.fromtimestamp(int(value / 1000)) + offset
    return result.strftime("%Y-%m-%d %H:%M")
Exemplo n.º 2
0
def format_datetime(value):
    if value is None:
        return ""

    now_timestamp = time.time()
    offset = datetime.fromtimestamp(now_timestamp) - datetime.utcfromtimestamp(
        now_timestamp)
    value = datetime.fromtimestamp((int(value) / 1000)) + offset
    return value.strftime("%Y-%m-%d %H:%M:%S")
Exemplo n.º 3
0
def format_datetime2(value):
    if value is None:
        return ""

    now_timestamp = time.time()
    offset = datetime.fromtimestamp(now_timestamp) - datetime.utcfromtimestamp(
        now_timestamp)
    value = datetime.fromtimestamp((int(value) / 1000)) + offset
    return value.strftime('%m/%d')
Exemplo n.º 4
0
def format_datetime(value):
    if value is None:
        return ""

    now_timestamp = time.time()  # 클라이언트의 현재 시간
    # 시간 차이 = datetime형 현재시간 - datetime형 UTC 시간
    offset = datetime.fromtimestamp(now_timestamp) - datetime.utcfromtimestamp(
        now_timestamp)
    value = datetime.fromtimestamp(int(value) / 1000) + offset
    return value.strftime('%Y-%m-%d %H:%M:%S')
Exemplo n.º 5
0
def format_datetime(value):
    if value is None:
        return ""

    now_timestamp = time.time()
    offset = datetime.fromtimestamp(now_timestamp) - datetime.utcfromtimestamp(now_timestamp)
    #시간차이 = datetime형 현재시간 - datetime형 utc 시간
    #현재 타임기준으로 datetime 객체 만듬
    value = datetime.fromtimestamp((int(value) / 1000)) + offset
    return value.strftime('%Y-%m-%d %H:%M:%S')
Exemplo n.º 6
0
def format_datetime(value):
    if value is None:
        return ""

    # 현재 시간 타임스탬프를 구합니다.
    now_timestamp = time.time()

    # 현재 시간 타임스탬프를 현재 시간객체, UTC 시간 기준 시간객체로 변환하여
    # 현재 시간에서 UTC 시간을 빼 시간차를 구합니다.
    offset = datetime.fromtimestamp(now_timestamp) - datetime.utcfromtimestamp(
        now_timestamp)

    # 구해진 시간차만큼 저장된 시간정보에 더해줍니다.
    value = datetime.fromtimestamp((int(value) / 1000)) + offset

    # 원하는 형태의 시간 포맷으로 변경합니다.
    return value.strftime('%Y-%m-%d %H:%M:%S')