Skip to main content

Convert regular time into 12-hour days and nights

Project description

balancedtime

pypi_ver

Using balancedtime

balancedtime has two methods, one to get the current or specified time in a given location, and one to output a handy clock conversion for today in a given location.

convert_time_to_balanced_time(time=None, zipcode=10010, pretty_print=False) the ‘time’ argument can be a datetime.datetime object. ‘zipcode’ can be a contiguous US ZIP code

pretty_print will output a datetime.datetime object if False, and a text representation of the time (in a 12 hour format with AM/PM) if True.

Examples

The following examples demonstrate the functionality available in the module

convert_time_to_balanced_time

>>> import balancedtime
>>> balanced_time.convert_time_to_balanced_time(time=datetime.datetime(2018,5,3,6,30),zipcode=10010,pretty_print=True) #time in NYC on May 3, 2018, at 6:30 AM
'06:32:06 AM'
>>> balanced_time.convert_time_to_balanced_time(time=datetime.datetime(2018,5,3,6,30),zipcode=10010,pretty_print=False) #same, but return a datetime.datetime object
datetime.datetime(2018, 5, 3, 6, 32, 6, 185567)

clock_conversion

>>> clock_conversion(zipcode=10010)

balanced calendar for New York, NY, 2018/11/18
  old   :  balanced
12:00 AM = 12:15:50 AM
1:00 AM  = 01:06:44 AM
2:00 AM  = 01:57:38 AM
3:00 AM  = 02:48:32 AM
4:00 AM  = 03:39:26 AM
5:00 AM  = 04:30:20 AM
6:00 AM  = 05:21:14 AM
7:00 AM  = 06:17:27 AM
8:00 AM  = 07:30:36 AM
9:00 AM  = 08:43:46 AM
10:00 AM = 09:56:55 AM
11:00 AM = 11:10:04 AM
12:00 PM = 12:23:14 PM
1:00 PM  = 01:36:23 PM
2:00 PM  = 02:49:32 PM
3:00 PM  = 04:02:42 PM
4:00 PM  = 05:15:51 PM
5:00 PM  = 06:20:08 PM
6:00 PM  = 07:10:55 PM
7:00 PM  = 08:01:42 PM
8:00 PM  = 08:52:29 PM
9:00 PM  = 09:43:17 PM
10:00 PM = 10:34:04 PM
11:00 PM = 11:24:51 PM

Installation

Install balanced_time by running:

pip install balancedtime

Contribute

Version History

Version

Description

0.1b

First release

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

balancedtime-0.16b0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

balancedtime-0.16b0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file balancedtime-0.16b0.tar.gz.

File metadata

  • Download URL: balancedtime-0.16b0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.2

File hashes

Hashes for balancedtime-0.16b0.tar.gz
Algorithm Hash digest
SHA256 776f301b8382c27d9d8423eca8d6717e5c26566c949f79e89623b9999a9560e1
MD5 12efbc23ee43ee6b225dfc19518e8b73
BLAKE2b-256 d951c496383167a0e49b8d63323969a5ad9f73e6ab1788bb67f91889b45383fb

See more details on using hashes here.

File details

Details for the file balancedtime-0.16b0-py3-none-any.whl.

File metadata

  • Download URL: balancedtime-0.16b0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.2

File hashes

Hashes for balancedtime-0.16b0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9740603fa5db9f02c700c4db02537d99864d43b6ceb2675de709419c87cfadc
MD5 df300fbc7d5e55f500e98c690da00929
BLAKE2b-256 67aa4cf578a92e0c41cace48559761960c1a73dbf6953e637537307c269cf5f9

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