Skip to main content

Library converting string date expressions to seconds [int].

Project description

Better Time

Better Time - is a Python library, converting string date expressions to seconds [int].

Installition

PyPI:

$ [py -m] pip install bettertime

GitHub:

$ git clone https://github.com/DarkJoij/bettertime

Examples

Converting from string expressions to seconds:

from bettertime import to_seconds

print(to_seconds('5hours 30minutes'))
19800

Converting from seconds to string expressions:

from bettertime import to_string

print(to_string(793800, language='en'))
9d 4h 30m
  • Function to_seconds take parameter expression: str.
  • Function to_string take 2 parameters: seconds: int, language: 'ru' | 'en' = 'ru'.

To see all dates aliases check file bettertime/parser.py.

Sweet using and building your lovely dsbots)

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

bettertime-1.0.0.tar.gz (4.2 kB view hashes)

Uploaded Source

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