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.
  • 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

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


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)

Uploaded Source

Built Distribution

unic-0.1.1-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

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