Python package for converting various units.
Project description
unic
unic is a python package that can convert various units.
Conversion Targets
- The current available conversion targets are as follows.
Time Unit
- Time
- minute / second / milisecond → hour
- hour / second / milisecond → minute
- hour / minute / milisecond → second
- hour / minute / second → milisecond
- Datetime
- unixtime / unixtime+timezone → datetime.datetime
- unixtime / unixtime+timezone → datetime.date
- Unixtime
- string(yyyy-mm-dd hh:mm:ss) / string(yyyy-mm-dd hh:mm:ss)+timezone → unixtime
Installing
pip install unic
Example
Time Unit
Time
import unic
converter = unic.TimeModel()
# Convert hour to minute
convert_min = converter.convert(2, from_unit="hour", to_unit="min")
Datetime
import unic
converter = unic.DatetimeModel()
# Convert to datatime
convert_datetime = converter.convert(1577841753, target="datetime")
Unixtime
import unic
converter = unic.UnixtimeModel()
# Specify time zone
convert_unixtime = converter.convert("2023-05-12 10:15:20", tz="Asia/Tokyo")
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
unic-0.2.2.tar.gz
(5.8 kB
view details)
Built Distribution
unic-0.2.2-py3-none-any.whl
(7.9 kB
view details)
File details
Details for the file unic-0.2.2.tar.gz
.
File metadata
- Download URL: unic-0.2.2.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.1 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2acf609f6c6957ba74e410b7fb71273a9cf7a4fb69bc1fa841664b8d99474828 |
|
MD5 | ec9782509e98751ce2d5fc340afdde2b |
|
BLAKE2b-256 | 0167fd65255f2a901ca7890760ea3d3b601ad73fcf522f870491eb818cb9316d |
File details
Details for the file unic-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: unic-0.2.2-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.1 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0ae016d6ead2f4c73c46368c60b709b511143aef047106795ddd7170b6aea28 |
|
MD5 | f2cadb48b6ba88230b6f12e6534ffbeb |
|
BLAKE2b-256 | eed1a53ec6968fa624d656dbc55128dfefe7d0f4b19ad35fbeba5d23980dde05 |