GentBG - why bother to burn STEEM?

Image
by joviansummer original STEEMIT post: https://steemit.com/blog/@joviansummer/gentbg-why-bother-to-burn-steem GentBG - a new experiment to burn STEEM Hello, this is @joviansummer(witness: @jswit). I'd like to briefly explain why I bothered to start @gentbg experiment. Unlike bitcoin, STEEM has no supply limit. As long as STEEM exists, newly minted STEEM will be added to total supply. If we can't maintain corresponding demand or reduce supply, downward pressure on STEEM price can be a big challenge. @gentbg project is an experiment to reduce STEEM supply by burning. @gentbg will burn liquid author reward and delegate SP reward to @jsup to get amplified upvotes. The main purpose is to create a perpetual STEEM burning loop. I added a bit of fun factor via AI-generated images, to incentivize giving upvotes to @gentbg's posts. If you have some spare voting power, you can contribute to burning STEEM by giving upvotes to @gentbg's posts. Initial run of this experiment wil...

파이썬에서 시간대(timezone) 변경

by joviansummer
original STEEMIT post: https://steemit.com/blog/@joviansummer/timezone


파이썬에서 시간대(timezone)를 변경하는 방법을 간단하게 메모해 둡니다.

datetime 모듈과 dateutil 모듈을 사용해서 현재 시간을 다른 시간대로 변환해서 출력할 수 있습니다.

from datetime import datetime
import pytz

# 현재 시각을 UTC/GMT 기준으로 now에 할당
now = datetime.utcnow()

# 현재 시각을 지역 시간대 기준으로 now_local에 할당
now_local = datetime.now()

datetime 객체인 now에 저장된 시간 정보를 원하는 형식에 맞춰서 문자열로 출력하기 위해 strftime() 함수를 이용합니다.

# 현재 시각 출력 (UTC/GMT)
now.strftime("%Y-%m-%d %H:%M:%S")

'2021-04-10 13:48:54'

# 현재 시각 출력 (KST)
now_local.strftime("%Y-%m-%d %H:%M:%S")

'2021-04-10 22:48:54'

위의 값은 UTC/GMT 기준이므로, 이것을 한국 시간대로 바꿉니다. 우선 시간대 정보(tzinfo)를 가져와 변수 UTC, KST에 할당합니다.

# 한국 시간대 정보를 KST에 할당
UTC = pytz.timezone('UTC')
KST = pytz.timezone('Asia/Seoul')

now에 할당된 datetime 객체에 시간대가 GMT/UTC라는 정보를 추가합니다.

# now의 시간대 정보를 UTC로 설정하여 now_utc에 할당
now_utc = now.replace(tzinfo=UTC)

now_utc의 시간대가 GMT/UTC라고 명시되었으므로, 이 시간 정보를 다른 시간대 기준으로 환산할 수 있습니다.

# now_utc의 시간대를 한국 시간대로 변환하여 now_kst에 할당
now_kst=now_utc.astimezone(KST)

시간대 정보를 한국 시간대로 변경한 now_kst의 시간 정보를 출력해 봅니다.

now_kst.strftime("%Y-%m-%d %H:%M:%S") '2021-04-10 22:48:54'

Comments

Popular posts from this blog

스티미언의 영향력 지수 계산

jsup/avle code update - you don't have to write post everyday

jsup/avle 보팅 코드 갱신 - 1일1포스팅 강박에서 벗어나기