Skip to main content

python-thaidate

Project description

Project Thaidate

Status : 0.1.5 - alpha

Installation

    pip install thaidate

Usage

from thaidate import thaidate
from datetime import date

'''
    thaidate('วัน เดือน ปี', True/False) หรือ thaidate('ปี เดือน วัน', True/False)
    ex1: 
        ใช้เมื่อปี คือ พ.ศ. เช่น วันที่ 1 เดือนกุมภาพันธ์ ปี พ.ศ. 5
        x = thaidate(date(5 2 1), True) 

    ex2: 
        ใช้เมื่อปี คือ ค.ศ. เช่น วันที่ 1 เดือนกุมภาพันธ์ ปี ค.ศ. 5
        x = thaidate(date(5 2 1), False) 
        หรือ
        x = thaidate(date(5 2 1))

    ex3:
        สำหรับแสดงวันที่ปัจจุบัน
        x = thaidate()   

'''

x = thaidate()
print(x.day)                # x.day แสดงวันที่ เช่น วันที่ 1
print(x.full_month)         # x.full_month แสดงเดือนแบบเต็ม เช่น มกราคม
print(x.short_month)        # x.short_month แสดงเดือนแบบย่อ เช่น ม.ค.
print(x.year)               # x.year แสดงปี พ.ศ.
print(x.weekday)            # x.weekday แสดงวันในสัปดาห์ เช่น วันอาทิตย์

print(x.date)               # x.date แสดงวันที่ เดือน ปีพุทธศักราช เช่น 5 พฤศจิกายน 2536
print(x.short_date)         # x.date แสดงวันที่ เดือน ปีพุทธศักราช เช่น 5 พ.ย. 2536

print(x.full_date)          # x.full_date  แสดงวัน เดือน ปี ในรูปแบบเต็ม 
วัน.......ที่ ..... เดือน...... ปีพุทธศักราช ...... 

print(x.rattanakosin_era)   # x.rattanakosin_era  แสดงปี ร.ศ.

Chengelog

0.1.5
- แก้ไข bug แสดงผลไม่ถูกต้อง


ตั้งแต่เวอร์ชัน 0.1.0 ลงไป มีบัคการแสดงผลไม่ถูกต้อง ควรใช้ เวอร์ชัน 0.1.5 ขึ้นไป

0.1.0  
- เปลี่ยนวิธีการแสดงผลวัน วันที่ เดือน ปี ในรูปแบบเต็ม จากเดิมต้องเรียกในรูปแบบเมธอด [x.full_date()] เป็น [x.full_date] ได้เลย
- เพิ่มแอททริบิวต์สำหรับแสดงวันที่ เดือน ปี 
       [x.date] =>  [x.day] [x.full_month] [x.year]
       [x.short_date] =>  [x.day] [x.short_month] [x.year]

0.0.1b
- เพิ่มแอททริบิวต์สำหรับแสดง วันในสัปดาห์ [x.weekday] วันที่ [x.day] เดือน [x.full_month] [x.short_month] ปี [x.year]
- เพิ่มแอททริบิวต์สำหรับปี ร.ศ. [x.rattanakosin_era]
- เพิ่มเมธอด สำหรับแสดงวัน วันที่ เดือน ปี ในรูปแบบเต็ม [x.full_date()]
        [x.full_date()] => วัน [x.weekday] ที่ [x.day] เดือน [x.month] ปีพุทธศักราช [x.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

thaidate-0.1.5.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thaidate-0.1.5-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file thaidate-0.1.5.tar.gz.

File metadata

  • Download URL: thaidate-0.1.5.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for thaidate-0.1.5.tar.gz
Algorithm Hash digest
SHA256 0a0000f4e1e4424a42b6ff28c0ed51f5055e5f8ccda8765bf176e852a81cb096
MD5 6376d5bdfb2460237c42280306f33a06
BLAKE2b-256 a08abb4eff0bf397952e653b9568c60332f2cdbd86d610088b660c7537cc1ef0

See more details on using hashes here.

File details

Details for the file thaidate-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: thaidate-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for thaidate-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f377d7731719067a5e5bf6a374ce1db3254c538149ea4da12a52906525147f43
MD5 8f2a7a8d22efa33228901856f9c1f30e
BLAKE2b-256 955d580473b2617726087d0bd90f5ca106fcc6c5babbffc622749673f955aa86

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