currenttime() - 현재시간 함수화
2022. 3. 25. 23:33ㆍBackEnd
import pytz
import datetime
def currenttime():
tz1 = pytz.timezone("UTC")
tz2 = pytz.timezone("Asia/Seoul")
dt = strftime("%Y-%m-%d %H:%M:%S", gmtime())
dt = datetime.datetime.strptime(dt,"%Y-%m-%d %H:%M:%S")
dt = tz1.localize(dt)
dt = dt.astimezone(tz2)
dt = dt.strftime("%Y-%m-%d %H:%M:%S")
return dt'BackEnd' 카테고리의 다른 글
| systemctl 사용 (0) | 2022.03.29 |
|---|---|
| python datetime.datetime => convert datetime to string (0) | 2022.03.26 |
| REFERENCES 외래키 주기 (0) | 2022.03.24 |
| 2022-03-23(erc 셋팅 ) (0) | 2022.03.24 |
| env (0) | 2022.03.23 |