python-thaidate
Project description
Project Thaidate
Status : - alpha
Installation
pip install thaidate
Usage
from thaidate import thaidate
from datetime import date
'''
thaidate(date(ปี, เดือน, วัน), 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 แสดงปี ร.ศ.
#####################################################################
y = thaidatetime() # ใช้คำสั่งนี้ สำหรับการแสดงวันเดือนปี ชั่วโมงนาทีวินาที
print(y.hour) # แสดงชั่วโมง
print(y.minute) # แสดงนาที
print(y.fulltime) # แสดงเวลา ในรูปแบบ 'เวลา ... นาฬิกา ... นาที ... วินาที'
print(y.datetime) # แสดงวันและเวลา ในรูปแบบ '5 พฤศจิกายน 2536 เวลา ... นาฬิกา ... นาที ... วินาที'
print(y.fulldatetime) # แสดงวันและเวลา ในรูปแบบ 'วัน.......ที่ ..... เดือน...... ปีพุทธศักราช ...... เวลา ... นาฬิกา ... นาที ... วินาที'
print(y.short_datetime) # แสดงวันและเวลา ในรูปแบบ 'วันที่ เดือน(ตัวย่อ) ปี เวลา ... นาฬิกา ... นาที ... วินาที'
Changelog
0.2.2
- เพิ่ม การแสดงวันและเวลา โดยใช้คำสั่ง x = thaidatetime() [ถ้าหากต้องการแสดงแค่รูปแบบวัน ไม่รวมเวลา ให้ใช้คำสั่ง x = thaidate() ตามเดิม]
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
Release history Release notifications | RSS feed
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.2.2.tar.gz
(4.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file thaidate-0.2.2.tar.gz.
File metadata
- Download URL: thaidate-0.2.2.tar.gz
- Upload date:
- Size: 4.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.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
182b9e10b724fa5c4132f50f20681b24e1742e043493aeca55d7c086e796f9bf
|
|
| MD5 |
f079f35ba79c6931b4f72893b0cd78b2
|
|
| BLAKE2b-256 |
6d0b08a0a95f0d768a54751cff1a0c9378c7c4efab01da03a34c690157f4b9f8
|
File details
Details for the file thaidate-0.2.2-py3-none-any.whl.
File metadata
- Download URL: thaidate-0.2.2-py3-none-any.whl
- Upload date:
- Size: 4.1 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.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb52b906f2d0abd60fecc046bf60896d414adae9a6d72b1e31137fcf249973de
|
|
| MD5 |
c4eef4608e98031bdf985f5e0f88b385
|
|
| BLAKE2b-256 |
6e18bb905c8ef26449a58b4e07ca13a280390680557380f50d6ab8e408d083a8
|