๐Ÿ Python

[Python] influxdb ์‚ฝ์ž… ์‹œ timezone ์ฃผ์˜์‚ฌํ•ญ (feat. datetime.now()๋ฅผ ์ง€์–‘ํ•˜์ž)

iseunghan 2024. 2. 23. 15:37
๋ฐ˜์‘ํ˜•

Intro

ํŒŒ์ด์ฌ์œผ๋กœ InfluxDB์— ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅ์‹œํ‚ค๋Š” ๋ชจ๋“ˆ์„ ๊ฐœ๋ฐœํ•˜๋‹ค ์ด์ƒํ•œ์ ์ด ์ƒ๊ฒผ์Šต๋‹ˆ๋‹ค. KST๋กœ ๋„ฃ์—ˆ๋Š”๋ฐ ์ด๊ฒŒ ๊ทธ๋Œ€๋กœ UTC๋กœ ๋“ค์–ด๊ฐ€ ์žˆ๊ฑฐ๋‚˜ ๋ถ„๋ช… UTC๋กœ ์ €์žฅ์‹œ์ผฐ๋Š”๋ฐ KST๋กœ ์ €์žฅ๋˜์–ด์žˆ๊ฑฐ๋‚˜.. ํฌํ•œํ•œ ํ˜„์ƒ์ด ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ํŒŒ์ด์ฌ ์ฝ”๋“œ๋ฅผ ์ „๋ถ€ ๊นŒ๋ณด๋ฉฐ influxDB ์ €์žฅํ•  ๋•Œ ์‹œ๊ฐ„์„ ๋ณ€ํ™˜ํ•˜๋Š”์ง€์™€ ์„œ๋ฒ„ ํƒ€์ž„์กด๊ณผ ๊ด€๋ จ์ด ์žˆ๋Š”์ง€ ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

์„œ๋ฒ„์˜ ํƒ€์ž„์กด์ด ๋‹ค๋ฅด๋ฉด, influxdb์—๋Š” ์‹œ๊ฐ„์ด ์–ด๋–ป๊ฒŒ ์ฐํž๊นŒ?

TL;DR

๐Ÿ’ก ์„œ๋ฒ„ ์‹œ๊ฐ„์— ๋”ฐ๋ผ์„œ `datetime.timestamp()` ํ•จ์ˆ˜๊ฐ€ UTC ์‹œ๊ฐ„์œผ๋กœ ๋ณด์ •ํ•˜์—ฌ ๋ณ€ํ™˜ํ•œ๋‹ค. ๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— ์„œ๋ฒ„ ํƒ€์ž„์กด์— ๋”ฐ๋ผ์„œ timestamp()์˜ ๊ฒฐ๊ณผ๊ฐ€ ๋‹ฌ๋ผ์งˆ ๋ฟ, influxdb_client ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ํ†ตํ•ด ๋ฐ์ดํ„ฐ ์‚ฝ์ž… ์‹œ์—๋Š” ๋”ฐ๋กœ ์‹œ๊ฐ„์ด ๋ณ€ํ™˜๋˜์ง€ ์•Š๋Š”๋‹ค. ์ž…๋ ฅ ์‹œ๊ฐ„์„ ๋ฌด์กฐ๊ฑด UTC๋กœ ๊ฐ„์ฃผํ•œ๋‹ค.

๊ณตํ†ต ํ…Œ์ŠคํŠธ ์ฝ”๋“œ

client = InfluxDBClient(url='http://localhost:8086', token='my-secret-token', org="myorg")

now = datetime.now()

utc = pytz.timezone('UTC')
seoul = pytz.timezone('Asia/Seoul')

now_utc = datetime.utcnow()
now_kst = datetime.now(tz=seoul)
print("------------------------------------------")
print('UTC tz: ', now_utc)
print('KST tz: ', now_kst)
print("------------------------------------------")

utc_nano = int((now_utc.timestamp()) * 10 ** 9)
kst_nano = int((now_kst.timestamp()) * 10 ** 9)
print("UTC-NS: ", utc_nano)
print("KST-NS: ", kst_nano)
print("------------------------------------------")

utc_body = Point(f"test-measure-{str(utc_nano)[-3:-1]}").time(utc_nano).field('utc', utc_nano)
kst_body = Point(f"test-measure-{str(utc_nano)[-3:-1]}").time(kst_nano).field('kst', kst_nano)

write_api = client.write_api(write_options=SYNCHRONOUS)
write_api.write(bucket='test-bucket', org='myorg', record=kst_body)
write_api.write(bucket='test-bucket', org='myorg', record=utc_body)
write_api.close()
print("UTC-Influx-Point --> ", utc_body)
print("KST-Influx-Point --> ", kst_body)
print("------------------------------------------")

client.close()

Case 1) ์„œ๋ฒ„ ์‹œ๊ฐ„: KST ์„ค์ •

/ # date
Fri Feb 23 12:22:05 KST 2024

/ # python3 Test.py
------------------------------------------
UTC tz:  2024-02-23 03:22:10.295505
KST tz:  2024-02-23 12:22:10.295507+09:00
------------------------------------------
UTC-NS:  1708626130295505152 # -9์‹œ๊ฐ„ ๋จ, **2024-02-22T18:22:10.295Z**
KST-NS:  1708658530295506944 # -9์‹œ๊ฐ„ ๋จ, **2024-02-23T03:22:10.295Z**
------------------------------------------
UTC-Influx-Point -->  test-measure-15 utc=1708626130295505152i 1708626130295505152
KST-Influx-Point -->  test-measure-15 kst=1708658530295506944i 1708658530295506944
------------------------------------------

influxdb ๊ฒฐ๊ณผ

  • UTC, _time: 2024-02-22T18:22:10.295Z, _value: 1708626130295505200 ,
    ๊ฒฐ๋ก : UTC์ง€๋งŒ, ์„œ๋ฒ„์‹œ๊ฐ„์ด KST๋ผ -9์‹œ๊ฐ„ ๋ณด์ •๋จ

  • KST, _time: 2024-02-23T03:22:10.295Z, _value: 1708658530295507000 ,
    ๊ฒฐ๋ก : KST์ด๊ณ , ์„œ๋ฒ„๊ฐ€ KST๋ผ -9์‹œ๊ฐ„ ๋ณด์ •๋จ

Case 2) ์„œ๋ฒ„ ์‹œ๊ฐ„: UTC ์„ค์ •

/ # date
Fri Feb 23 03:32:49 UTC 2024

/ # python3 Test.py
------------------------------------------
UTC-pytz:  UTC
Seoul-pytz:  Asia/Seoul
------------------------------------------
UTC tz:  2024-02-23 03:32:53.333882
KST tz:  2024-02-23 12:32:53.333884+09:00
------------------------------------------
UTC-NS:  1708659173333882112 # -0์‹œ๊ฐ„ ๋จ, **2024-02-23T03:32:53.333Z**
KST-NS:  1708659173333883904 # -9์‹œ๊ฐ„ ๋จ, **2024-02-23T03:32:53.333Z**
------------------------------------------
UTC-Influx-Point -->  test-measure-11 utc=1708659173333882112i 1708659173333882112
KST-Influx-Point -->  test-measure-11 kst=1708659173333883904i 1708659173333883904
------------------------------------------

  • UTC, _time: 2024-02-23T03:32:53.333Z, _value: 1708659173333882000 , ๊ฒฐ๋ก : UTC์ด๋ฏ€๋กœ ๊ทธ๋Œ€๋กœ ์ €์žฅ๋จ

  • KST, _time: 2024-02-23T03:32:53.333Z, _value: 1708659173333884000 , ๊ฒฐ๋ก : KST์ด๋ฏ€๋กœ -9์‹œ๊ฐ„ ๋ณด์ •๋จ

์„œ๋ฒ„ ์‹œ๊ฐ„์ด ๋‹ค๋ฅด๋ฉด ์™œ ์‹œ๊ฐ„์ด ๋‹ค๋ฅด๊ฒŒ ์ €์žฅ๋ ๊นŒ? - ๋ฌธ์ œ๋Š” timestamp()์ด๋‹ค

์„œ๋ฒ„ ์‹œ๊ฐ„์ด ๋‹ค๋ฅผ ๋•Œ, ์™œ ์‹œ๊ฐ„์ด ๋‹ค๋ฅด๊ฒŒ ๋ณด์ •๋์„๊นŒ์š”?

๋ฌธ์ œ๋Š” ๋ฐ”๋กœ datetime.timestamp() ํ•จ์ˆ˜์— ์žˆ์Šต๋‹ˆ๋‹ค.

๋ณดํ†ต datetime.now()๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด, ๊ธฐ๋ณธ์ ์œผ๋กœ tzinfo๊ฐ€ None์œผ๋กœ ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค.

@classmethod
def now(cls, tz=None):
    "Construct a datetime from time.time() and optional time zone info."
    t = _time.time()
    return cls.fromtimestamp(t, tz)

๊ทธ๋ž˜์„œ ์•„๋ž˜ timestamp ๋ถ€๋ถ„์„ ์‚ดํŽด๋ณด๋ฉด, tzinfo๊ฐ€ None์ผ ๋•Œ _mktime()์„ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.

def timestamp(self):
      "Return POSIX timestamp as float"
      if self._tzinfo is None:
          s = self._mktime()
          return s + self.microsecond / 1e6
      else:
          return (self - _EPOCH).total_seconds()

_mktime ํ•จ์ˆ˜๋ฅผ ์‚ดํŽด๋ณด๋ฉด, time.localtime(second) ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ, ์‹œ์Šคํ…œ์˜ ํƒ€์ž„์กด์— ๋”ฐ๋ผ ๋ณ€ํ™˜๋œ ์‹œ๊ฐ„์„ ๊ฐ€์ง€๊ณ  ๊ทธ ์‹œ๊ฐ„๋“ค์„ ๊ณ„์‚ฐํ•ด์„œ ๋ณด์ •ํ•˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

def _mktime(self):
    """Return integer POSIX timestamp."""
    epoch = datetime(1970, 1, 1)
    max_fold_seconds = 24 * 3600
    t = (self - epoch) // timedelta(0, 1)
    def local(u):
        y, m, d, hh, mm, ss = _time.localtime(u)[:6]
        return (datetime(y, m, d, hh, mm, ss) - epoch) // timedelta(0, 1)

    # Our goal is to solve t = local(u) for u.
    a = local(t) - t
    u1 = t - a
    t1 = local(u1)
    if t1 == t:
        # We found one solution, but it may not be the one we need.
        # Look for an earlier solution (if `fold` is 0), or a
        # later one (if `fold` is 1).
        u2 = u1 + (-max_fold_seconds, max_fold_seconds)[self.fold]
        b = local(u2) - u2
        if a == b:
            return u1
    else:
        b = t1 - u1
        assert a != b
    u2 = t - b
    t2 = local(u2)
    if t2 == t:
        return u2
    if t1 == t:
        return u1
    # We have found both offsets a and b, but neither t - a nor t - b is
    # a solution.  This means t is in the gap.
    return (max, min)[self.fold](u1, u2)

๊ฒฐ๋ก  - datetime.now()๋ฅผ ์ง€์–‘ํ•˜๊ณ  datetime.now(tz)๋ฅผ ์ง€ํ–ฅํ•˜์ž

KST ํƒ€์ž„์กด ์„ค์ •๋œ ์„œ๋ฒ„์—์„œ UTC ์‹œ๊ฐ„๊ณผ KST ๋‘˜ ๋‹ค -9์‹œ๊ฐ„ ๋ณด์ •๋œ๊ฒŒ ๋ญ”๊ฐ€ ์ด์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. UTC๋Š” ๊ทธ๋ƒฅ ๋ƒ…๋‘ฌ์•ผ ๋˜๋Š”๊ฒŒ ์•„๋‹Œ๊ฐ€? ๋ผ๊ณ  ์ƒ๊ฐ์œผ๋กœ ๋‹ค์‹œ ์ฝ”๋“œ๋ฅผ ์‚ดํŽด๋ดค์Šต๋‹ˆ๋‹ค.

๋ฌธ์ œ๋Š” ๋ฐ”๋กœ datetime.utcnow() ์ด ๋…€์„์ž…๋‹ˆ๋‹ค.

now_utc = datetime.utcnow()
# UTC tz:  2024-02-23 03:20:29.093107

utcnow ํ•จ์ˆ˜๋ฅผ ๋“ค์–ด๊ฐ€๋ด…์‹œ๋‹ค.

@classmethod
def utcnow(cls):
    "Construct a UTC datetime from time.time()."
    t = _time.time()
    return cls.utcfromtimestamp(t)

@classmethod
def utcfromtimestamp(cls, t):
    """Construct a naive UTC datetime from a POSIX timestamp."""
    return cls._fromtimestamp(t, True, None)

@classmethod
def _fromtimestamp(cls, t, utc, tz):
    """Construct a datetime from a POSIX timestamp (like time.time()).

    A timezone info object may be passed in as well.
    """
        ...

๋„ค ๋ฐ”๋กœ utc๋ฅผ ์ƒ์„ฑํ•  ๋•Œ, tz์— None์„ ์ฃผ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

๊ทธ๋ž˜์„œ utcnow()๋กœ ์ƒ์„ฑํ•œ datetime์˜ tzinfo๋ฅผ ํ˜ธ์ถœํ•ด๋ณด๋ฉด None์œผ๋กœ ๋‚˜์˜ต๋‹ˆ๋‹ค.

>>> print(datetime.utcnow().tzinfo)
None

๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— tzinfo๊ฐ€ None์ด๋ฏ€๋กœ ์–˜๊ฐ€ UTC์ธ์ง€ KST์ธ์ง€์— ๋Œ€ํ•œ ์ •๋ณด๊ฐ€ ์—†์œผ๋ฏ€๋กœ ๊ทธ๋ƒฅ -9์‹œ๊ฐ„ ๋ณด์ •์ด ๋“ค์–ด๊ฐ„ ๊ฒƒ ์ž…๋‹ˆ๋‹ค.

datetime.now() ์˜ ์‚ฌ์šฉ์„ ์ง€์–‘ํ•˜๊ณ , datetime.now(tz=timezone.utc) ๋ฅผ ์ง€ํ–ฅํ•˜์ž ์ž…๋‹ˆ๋‹ค.

dt.datetime.now(dt.timezone.utc)
datetime.datetime(2024, 2, 23, 5, 34, 16, 146937, tzinfo=datetime.timezone.utc)

timezone ์ •๋ณด๊ฐ€ ์—†๋‹ค๋ฉด ์ด ์‹œ๊ฐ„์ด ์–ด๋–ค ์‹œ๊ฐ„๋Œ€์ธ์ง€ ์•Œ๊ธฐ ์–ด๋ ต์Šต๋‹ˆ๋‹ค. timezone์„ ์„ค์ •ํ•ด์ฃผ๊ณ  ๋‹ค์‹œ ํ…Œ์ŠคํŠธ๋ฅผ ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

/ # date
Fri Feb 23 14:24:12 KST 2024

/ # python3 Test.py
------------------------------------------
UTC tz:  2024-02-23 05:24:15.156322+00:00
KST tz:  2024-02-23 14:24:15.156330+09:00
------------------------------------------
UTC-NS:  1708665855156322048
KST-NS:  1708665855156329984
------------------------------------------
UTC-Influx-Point -->  test-measure-04 utc=1708665855156322048i 1708665855156322048
KST-Influx-Point -->  test-measure-04 kst=1708665855156329984i 1708665855156329984
------------------------------------------

๋ณด์ด์‹œ๋‚˜์š”? ๊ธฐ์กด์— ์—†์—ˆ๋˜ UTC tz: 2024-02-23 05:24:15.156322+00:00 ๋’ค์— +00:00 ์ด ๋ถ™์—ˆ์Šต๋‹ˆ๋‹ค. ๋ฐ”๋กœ GMT+0์ด๋ผ๋Š” ์ •๋ณด๊ฐ€ ์ถ”๊ฐ€๋œ ๊ฒƒ์ธ๋ฐ์š”. ์ด๋ ‡๊ฒŒ ๋˜๋ฉด KST ํƒ€์ž„์กด์„ ๊ฐ€์ง„ ์„œ๋ฒ„์—์„œ timestamp() ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ–ˆ์„ ๋•Œ -9์‹œ๊ฐ„์„ ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ๊ฒฐ๊ตญ ๋™์ผํ•œ ์‹œ๊ฐ„์ด ๋“ค์–ด๊ฐ„ ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ฒˆ์™ธ - ๋ฌธ์ž์—ด๋กœ ์ €์žฅํ•œ๋‹ค๋ฉด ๊ผญ timezone์„ ํฌํ•จ์‹œํ‚ค์ž

influxdb์— ๋ฌธ์ž์—ด ํ˜•ํƒœ๋กœ ๋„ฃ๊ณ  ์‹ถ์œผ์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. UTC ์‹œ๊ฐ„์— Z๋ฅผ ๋ถ™์—ฌ UTC๋ผ๋Š” ํ‘œํ˜„์„ ํ•ด์ฃผ๊ณ , KST๋กœ ๋ณ€ํ™˜ํ•œ ์‹œ๊ฐ„์„ ๋„ฃ์–ด์ฃผ๋Š” ์ฝ”๋“œ์ž…๋‹ˆ๋‹ค.

client = InfluxDBClient(url='http://localhost:8086', token='my-secret-token', org="myorg")

now = datetime.now()

utc = pytz.timezone('UTC')
seoul = pytz.timezone('Asia/Seoul')

now_utc = datetime.now(tz=utc)
now_kst = datetime.now(tz=seoul)
print("------------------------------------------")
print('UTC tz: ', now_utc)
print('KST tz: ', now_kst)
print("------------------------------------------")

utc = now_utc.strftime('%Y-%m-%dT%H:%M:%S.%fZ')
kst = now_kst.strftime('%Y-%m-%dT%H:%M:%S.%f')
print(f"UTC-strftime: {utc}")
print(f"KST-strftime: {kst}")
print("------------------------------------------")

utc_body = Point(f"test-measure-1").time(utc).field('utc', 100)
kst_body = Point(f"test-measure-1").time(kst).field('kst', 100)

write_api = client.write_api(write_options=SYNCHRONOUS)
write_api.write(bucket='test-bucket', org='in2wise', record=kst_body)
write_api.write(bucket='test-bucket', org='in2wise', record=utc_body)
write_api.close()

print("UTC-Influx-Point --> ", utc_body)
print("KST-Influx-Point --> ", kst_body)
print("------------------------------------------")

client.close()
/ # date
Fri Feb 23 15:02:50 KST 2024

/ # python3 Test.py
------------------------------------------
UTC tz:  2024-02-23 06:31:50.391616+00:00
KST tz:  2024-02-23 15:31:50.391623+09:00
------------------------------------------
UTC-strftime: 2024-02-23T06:31:50.391616Z
KST-strftime: 2024-02-23T15:31:50.391623
------------------------------------------
UTC-Influx-Point -->  test-measure-111 utc=100i 1708669910391616000 # GMT: 2024๋…„ February 23์ผ Friday AM 6:31:50.391
KST-Influx-Point -->  test-measure-111 kst=100i 1708702310391623000 # GMT: 2024๋…„ February 23์ผ Friday PM 3:31:50.391
------------------------------------------

utc ๋กœ์šฐ์—๋Š” ์‹ค์ œ utc ์‹œ๊ฐ„์„ ๋„ฃ์—ˆ๊ณ , kst ๋กœ์šฐ์—๋Š” kst ์‹œ๊ฐ„์„ ๋„ฃ์—ˆ์ง€๋งŒ client์—์„œ ๋”ฐ๋กœ kst๋ฅผ utc๋กœ ๋ณ€ํ™˜ํ•˜๊ฑฐ๋‚˜ ํ•˜๋Š” ์ž‘์—…์€ ์—†์—ˆ์Šต๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ Z๋Š” ์˜๋ฏธ๊ฐ€ ์—†์–ด๋ณด์ž…๋‹ˆ๋‹ค. ํƒ€์ž„์กด์— ๋Œ€ํ•œ ์ •๋ณด๊ฐ€ ์—†์œผ๋‹ˆ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” time์— ๋“ค์–ด๊ฐ€๋Š” ์‹œ๊ฐ„์„ utc๋กœ ๊ฐ„์ฃผํ•˜๊ณ  ๊ทธ๋Œ€๋กœ ์ €์žฅ์‹œํ‚ต๋‹ˆ๋‹ค.

ํƒ€์ž„์กด์„ ๊ผญ ํฌํ•จ์‹œํ‚ค์ž

๊ณต์‹๋ฌธ์„œ๋ฅผ ์ฐธ๊ณ ํ•ด์„œ ํƒ€์ž„์กด์„ ํฌํ•จ์‹œํ‚ค๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. 

utc = now_utc.strftime('%Y-%m-%dT%H:%M:%S.%f %Z') # ๋˜๋Š” %z๋ฅผ ์‚ฌ์šฉ
kst = now_kst.strftime('%Y-%m-%dT%H:%M:%S.%f %Z')
/ # date
Fri Feb 23 15:02:50 KST 2024

/ # python3 Test.py
------------------------------------------
UTC tz:  2024-02-23 06:34:43.474180+00:00
KST tz:  2024-02-23 15:34:43.474191+09:00
------------------------------------------
UTC-strftime: 2024-02-23T06:34:43.474180 UTC
KST-strftime: 2024-02-23T15:34:43.474191 KST
------------------------------------------
UTC-Influx-Point -->  test-measure-111 utc=100i 1708670083474180000 # GMT: 2024๋…„ February 23์ผ Friday AM 06:34:43.474
KST-Influx-Point -->  test-measure-111 kst=100i 1708670083474191000 # GMT: 2024๋…„ February 23์ผ Friday AM 06:34:43.474
------------------------------------------

์‹œ๊ฐ„ ๋’ค์— ํƒ€์ž„์กด์— ๋Œ€ํ•œ ์ •๋ณด๊ฐ€ ์žˆ์œผ๋‹ˆ, influxdb-client ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ UTC๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ์ €์žฅ์‹œํ‚ค๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ํ…Œ์ŠคํŠธ๋กœ ์ €ํฌ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฒฐ๋ก ์„ ๋‚ด๋ฆด ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๊ฒฐ๋ก 

influxdb Client๋Š” time์— ๋„ฃ์€ ์‹œ๊ฐ„์ด ๋”ฐ๋กœ ํƒ€์ž„์กด์ด ์—†๋‹ค๋ฉด(Z์˜ ๊ฒฝ์šฐ ํฌํ•จ) ๋ฌด์กฐ๊ฑด UTC๋กœ ๋ณธ๋‹ค. ๋งŒ์•ฝ ํƒ€์ž„์กด์ด ํฌํ•จ๋œ ๋ฌธ์ž์—ด์ด๋ผ๋ฉด, ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” UTC๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ์ €์žฅ์‹œํ‚จ๋‹ค.

REFERENCES

 

datetime — Basic date and time types

Source code: Lib/datetime.py The datetime module supplies classes for manipulating dates and times. While date and time arithmetic is supported, the focus of the implementation is on efficient attr...

docs.python.org

 

datetime — Basic date and time types

Source code: Lib/datetime.py The datetime module supplies classes for manipulating dates and times. While date and time arithmetic is supported, the focus of the implementation is on efficient attr...

docs.python.org

 

Epoch Converter

Convert Unix Timestamps (and many other date formats) to regular dates.

www.epochconverter.com

๋ฐ˜์‘ํ˜•