JitUtils
Description
Package นี้จัดทำมาเพื่อในการจัดการปัญหาในการแปลง Time stamp ให้อยู่ในรูปแบบ Date time ต่าง
Features
- รับค่า Timestamp
- สามารถแปลง Datetime ในหลายรูปแบบต่างๆ
- สามารถแปลง ค.ศ. ให้อยู่ในรูปแบบ พ.ศ. หรือ ฮ.ศ. ได้
A reference of all the legal format codes:
| Directive | Description | Example |
|---|---|---|
| %a | Weekday, short version | Wed |
| %A | Weekday, full version | Wednesday |
| %w | Weekday as a number 0-6, 0 is Sunday | 3 |
| %d | Day of month 01-31 | 31 |
| %b | Month name, short version | Dec |
| %B | Month name, full version | December |
| %m | Month as a number 01-12 | 12 |
| %y | Year, short version, without century | 18 |
| %Y | Year, full version | 2018 |
| %H | Hour 00-23 | 17 |
| %I | Hour 00-12 | 05 |
| %p | AM/PM | PM |
| %M | Minute 00-59 | 41 |
| %S | Second 00-59 | 08 |
| %f | Microsecond 000000-999999 | 548513 |
| %z | UTC offset | +0100 |
| %Z | Timezone | CST |
| %j | Day number of year 001-366 | 365 |
| %U | Week number of year, Sunday as the first day of week, 00-53 | 52 |
| %W | Week number of year, Monday as the first day of week, 00-53 | 52 |
| %c | Local version of date and time | Mon Dec 31 17:41:00 2018 |
| %x | Local version of date | 12/31/18 |
| %X | Local version of time | 17:41:00 |
| %% | A % character | % |
| %G | ISO 8601 year | 2018 |
| %u | ISO 8601 weekday (1-7) | 1 |
| %V | ISO 8601 weeknumber (01-53) | 01 |
How to using (วิธีนำไปใช้งาน)
from src import JitTimes
from datetime import datetime
from zoneinfo import ZoneInfo
time_stamp = datetime.timestamp(datetime.now())
print("time_stamp " + str(time_stamp))
# แปลงค่า DateTime ตาม Default format
jitTime = JitTimes(1617867109.1652)
print(jitTime)
jitTime2 = JitTimes(TS=time_stamp)
print(jitTime2)
# Time Zone
# Test fail
jitTime3 = JitTimes(TS=time_stamp, dt_format='%Y', tz_info=None)
print(jitTime3.tzInfo())
jitTime4 = JitTimes(TS=time_stamp, tz_info="Pacific/Kwajalein")
print(jitTime4.tzInfo())
print(datetime.timestamp(jitTime4.tzInfo()))
# การแปลงค่า เป็น พ.ศ. / ฮ.ศ.
j1 = JitTimes(TS=time_stamp, dt_format="%c", tz_info="America/Los_Angeles")
print("ค.ศ. ", j1)
j1 = JitTimes(TS=time_stamp, dt_format="%c", tz_info="America/Los_Angeles")
print("พ.ศ.", j1.buddhistEra())
j1 = JitTimes(TS=time_stamp, dt_format="%c", tz_info="America/Los_Angeles")
print("ฮ.ศ. ", j1.hijriEra())
Release files for pyjitutils 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyjitutils-1.0.1.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyjitutils-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.4 kB
Release files / pyjitutils-1.0.1.tar.gz
| Download URL | pyjitutils-1.0.1.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca38699d1e709537b4c473595d77a2ba24fdb11333143bf848cb106eb3febbba
|
|
BLAKE2b-256 checksum How to use checksums |
bd41ac41791088ccb1ba5a7ea9b6480e045b02ea21b48f6dc3965a061101114c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
|
Release files / pyjitutils-1.0.1-py3-none-any.whl
| Download URL | pyjitutils-1.0.1-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43a14975b5625aee5d7d57dfa6bdde3e934fae93ca4fbff511fa8b8046ef4a94
|
|
BLAKE2b-256 checksum How to use checksums |
8e61dd252ba3b75bcd96c41303a5eaf3cd66f078063f3e8575d8f298190fccae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
|