Skip to main content
https://travis-ci.org/tomi77/python-t77-date.svg?branch=master https://coveralls.io/repos/github/tomi77/python-t77-date/badge.svg?branch=master Code Climate

A set of functions related with dates

Installation

Install via pip

pip install t77_date

datetime module

start_of_day

Return a new datetime with values that represent a start of a day.

Example

>>> dt = datetime(2016, 7, 2, 21, 49, 12)
>>> sod = start_of_day(dt)
>>> print(sod)
2016-07-02 00:00:00

end_of_day

Return a new datetime with values that represent a end of a day.

Example

>>> dt = datetime(2016, 7, 2, 21, 49, 12)
>>> eod = end_of_day(now)
>>> print(eod)
2016-07-02 23:59:59.999999

start_of_month

Return a new datetime with values that represent a start of a month.

Example

>>> dt = datetime(2016, 7, 2, 21, 49, 12)
>>> som = start_of_month(dt)
>>> print(som)
2016-07-01 00:00:00

end_of_month

Return a new datetime with values that represent a end of a month.

Example

>>> dt = datetime(2016, 7, 2, 21, 49, 12)
>>> eom = end_of_day(now)
>>> print(eom)
2016-07-31 23:59:59.999999

set_next_week_day

Set week day. New date will be greater or equal than input date.

Example

>>> saturday = datetime(2016, 7, 2, 21, 49, 12)
>>> next_friday = set_next_week_day(saturday, ISO_FRIDAY, iso=True)
>>> print(next_friday)
2016-07-08 21:49:12
>>> next_friday = set_next_week_day(saturday, FRIDAY, iso=False)
>>> print(next_friday)
2016-07-08 21:49:12

set_prev_week_day

Set week day. New date will be less or equal than input date.

Example

>>> saturday = datetime(2016, 7, 2, 12)
>>> prev_friday = set_prev_week_day(saturday, ISO_FRIDAY, iso=True)
>>> print(prev_friday)
2016-07-01 21:49:12
>>> prev_friday = set_prev_week_day(saturday, FRIDAY, iso=False)
>>> print(prev_friday)
2016-07-01 21:49:12

Metadata

Release files for t77-date 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for t77-date 0.5.0
File Size Uploaded
t77-date-0.5.0.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for t77-date 0.5.0
File Interpreter ABI Platform
t77_date-0.5.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 9.8 kB

Release files / t77-date-0.5.0.tar.gz

Download URL t77-date-0.5.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2f4a1074b71554b0c972e99561dc72ebc3d69ac6fc55138609a731fc9e21603a
BLAKE2b-256 checksum
How to use checksums
5342671d1b6724a6a23ada539b26884f77f3a5ca1bf39a034eb30d8073bc977d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / t77_date-0.5.0-py2.py3-none-any.whl

Download URL t77_date-0.5.0-py2.py3-none-any.whl
Size 6.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
bf1a9db69db3f5dd09f19ec4d5baf1358d654af65224ba833147002286bfcc0d
BLAKE2b-256 checksum
How to use checksums
5f01dc980466e904ea836bc69a54d63c951bebd51d2eec2d4a47cf1a685e3c2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page