Skip to main content

Period Iterator

Project description

Period Iterator

Period Iterator is a library easing you to iterate through given period.

Usage

from period_iterator.period_iterator import period_iterator

period = period_iterator('2020-02-01,2020-02-03', 'Asia/Bangkok')

while True:
    print(period.cursor.begin()) # Begin of day
    print(period.cursor.end()) # End of day
    print(period.cursor.date()) # Date
    if not period.next():
        break

# Expected Output
#
# 2020-02-01T00:00:00+07:00
# 2020-02-01T23:59:59+07:00
# 2020-02-01
# 2020-02-02T00:00:00+07:00
# 2020-02-02T23:59:59+07:00
# 2020-02-02
# 2020-02-03T00:00:00+07:00
# 2020-02-03T23:59:59+07:00
# 2020-02-03

License

MIT

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

period-iterator-1.3.0.tar.gz (6.1 kB view hashes)

Uploaded Source

Built Distribution

period_iterator-1.3.0-py3-none-any.whl (6.4 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