Skip to main content

Create time and datetime objects using slice notation

Project description

slicetime

Create time and datetime objects using slice notation.

Importing slicettime overrides the standard library datetime objects so be sure to place it before actually using datetime. Otherwise, continue to use date, datetime, and time as before. But when you need an instance with a new time, use the digital clock notation to create it [hh:mm:ss.mmmmmm]

When the time class is called with this new notation, a new time instance is created and returned. When an existing either date or datetime is called with this new notation, a new datetime instance is returned that has the same date as the original instance, but the time specified in the slice.

Example

import datetime
import slicetime

new_time = datetime.time[12:30:5.55]
assert new_time.hour == 12
assert new_time.minute == 30
assert new_time.second == 5
assert new_time.microsecond == 55

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slicetime-0.1.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

slicetime-0.1-py2.py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 2 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