Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

getKST

A Python package that returns datetime values ​​for the Asia/Seoul region.

PyPI version Python versions License: MIT

Installation

Prerequisites

  • Python (>=3.9)

Install via pip

pip install getKST

Install via uv

uv add getKST

Usage

Note: 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))
  • Convert string type to datetime type

     from getKST import getKST
     
     KST = getKST().toDatetime()
     
     print(KST) # Will be printed as a datetime type

All Python datetime formats are supported.

Change Log

v1.1.1

  • Added usage example of toDatetime() method in README.md

v1.1.0

  • Added KSTString class that extends str, allowing the result of getKST() to be used as both a formatted string and a datetime object
  • Added KSTString.toDatetime() method to retrieve the underlying KST datetime object
  • Changed return type of getKST() from str to KSTString

v1.0.2

  • Added tzdata as a requirement on Windows
  • Added Change Log section at README.md

v1.0.1

v1.0.0

  • Published a package

License

MIT

About

A Python package that returns datetime values ​​for the Asia/Seoul region.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages