Skip to main content

No project description provided

Project description

japantime

日付や時刻を表示する際に文字列フォーマットの煩わしさから逃れることができる。

install

pip install japantime

usage

import jtime

print(jtime.wareki(1923))
>>> ('大正', 12)

print(jtime.eto(1945))
>>>('酉', 'とり')

import time
a = time.time()
time.sleep(3)
b = time.time()

print(jtime.time_lapse(b-a))
>>>'0時間0分3秒'

print(jtime.time_lapse(b-a, mode='s'))
>>>'0:0:3'

print(jtime.time_lapse(b-a, mode='e'))
>>>'0h0m3s'

# クラスJTimeは以下のメソッドを持つ
"""
    JTime.year() : yyyy年
    JTime.month() : m月
    JTime.day() : d日
    JTime.hour() : h時
    JTime.min() : m分
    JTime.sec() : s秒
    JTime.youbi() : 曜日
    JTime.wareki() : 元号n年
    JTime.eto() : (干支, えと)
    JTime.ymdhms() : yyyy年m月d日h時m分s秒
    JTime.ymd() : yyyy年m月d日
    JTime.ym() : yyyy年m月
    JTime.md() : m月d日
    JTime.hms() : h時m分s秒
    JTime.hm() : h時m分
    JTime.ms() : m分s秒
"""

# 半角表示
a = jtime.JTime()
print(a.year())
>>>'2024年'

# 全角表示
b = jtime.JTime(mode='z')
print(b.year())
>>>'2024年'

# 漢数字表示
c = jtime.JTime(mode='k')
print(c.year())
>>>'二〇二四年'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

japantime-1.1.9.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file japantime-1.1.9.tar.gz.

File metadata

  • Download URL: japantime-1.1.9.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for japantime-1.1.9.tar.gz
Algorithm Hash digest
SHA256 35e28228c6932c2ff06efbc7bf6f4083e6745e1610aa08418a07b7d9f9bd326b
MD5 c5f389750f0a861f789c34118930b682
BLAKE2b-256 f86083be99f595bf94395a622fe51f0b906618109e5c7789a100b911493c5816

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page