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

Uploaded Source

Built Distribution

unic-0.2.3-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: unic-0.2.3.tar.gz
  • Upload date:
  • Size: 5.9 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.3.tar.gz
Algorithm Hash digest
SHA256 c38748ce98563f4c7462e035ec8c2855d266f9842549927c30fe7cf3d4c5242b
MD5 969961882d2b2bc665206c66c2b8e040
BLAKE2b-256 a347086b841078612251d12d862479985a904697387e7e0fc4a1ffdf7d31b746

See more details on using hashes here.

File details

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

File metadata

  • Download URL: unic-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 8.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6ea7343b460965776372df5ee73a6c84b83dbf7c45d9e64d4c1dc0f2cbd0c5c2
MD5 634a2ea81e75be6b699c8739b5910f83
BLAKE2b-256 74194717967b7c68c4fb94f164acad473953791bb82ccfde77957f3ef470cfcb

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