A Python package that returns datetime values for the Asia/Seoul region.
- Python (>=3.9)
pip install getKSTuv add getKSTNote: Default format of getKST is %Y-%m-%d %H:%M:%S as a string.
getKST() always converts to Asia/Seoul time internally before formatting, so the result is identical no matter what timezone the host machine or server is set to (UTC, EST, JST, etc.).
- Basic Usage
from getKST import getKST now = getKST() print(now)
- Using other formats
from getKST import getKST now = getKST("%Y/%m/%d") # Year/Month/Date now = getKST("%H-%M-%S") # Hour-Minute-Second
- Converting an existing datetime
from datetime import datetime, timezone from getKST import getKST utc_now = datetime.now(tz=timezone.utc) print(getKST(dt=utc_now))
All Python datetime formats are supported.