Skip to main content

Python package for converting various units.

Project description

Python minimum version pytest black

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


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.4.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

unic-0.2.4-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file unic-0.2.4.tar.gz.

File metadata

  • Download URL: unic-0.2.4.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

Hashes for unic-0.2.4.tar.gz
Algorithm Hash digest
SHA256 a17f02f099bead9b3f89abd2e1fbc38c6c4dfdc9c35c3ff9f146aad9183a228b
MD5 9dccb04522fc89168124ebf1b706bac2
BLAKE2b-256 5723422c536d5fb40d92c77f3e7dfde902b92523861052b655180e45e774583f

See more details on using hashes here.

File details

Details for the file unic-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: unic-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.1 Windows/10

File hashes

Hashes for unic-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8517ce0382ace21a1fe5cb3a752cc6300f33c70bb808a1698ec241b1722e765d
MD5 36d4a5a905e03d331e8244c3ba7fba8d
BLAKE2b-256 efa9ba2142a54f88933313a2668b430e648f387b43f6223035d5819ac6925062

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page