Python package for converting various units.
Project description
unic
- unic is a Python package that can convert various units.
- The current available conversion targets are as follows.
- Time Unit
- minute / second / milisecond → hour
- hour / second / milisecond → minute
- hour / minute / milisecond → second
- hour / minute / second → milisecond
- Time Object
- unixtime / unixtime+timezone → datetime.datetime
- unixtime / unixtime+timezone → datetime.date
- Unix Time
- string(yyyy-mm-dd hh:mm:ss) / string(yyyy-mm-dd hh:mm:ss)+timezone → unixtime
- Time Unit
Installing
pip install unic
Example
Time Unit
import unic
converter = unic.TimeUnit()
# Convert hour to minute
converte_min = converter.convert(2, from_unit="hour", to_unit="min")
Time Object
import unic
converter = unic.TimeObject()
# Convert to datatime
converte_datetime = converter.convert(1577841753, target="datetime")
Unix Time
import unic
converter = unic.Unixtime()
# Specify time zone
converte_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.1.1.tar.gz
(5.1 kB
view hashes)
Built Distribution
unic-0.1.1-py3-none-any.whl
(7.2 kB
view hashes)