Skip to content

Instantly share code, notes, and snippets.

@edgarrmondragon
Created March 20, 2019 05:41
Show Gist options
  • Save edgarrmondragon/7881dc15ee7d032326d5637ed7bcfadc to your computer and use it in GitHub Desktop.
Save edgarrmondragon/7881dc15ee7d032326d5637ed7bcfadc to your computer and use it in GitHub Desktop.
import pendulum
date_period = pendulum.period(
pendulum.datetime(2019, 1, 1),
pendulum.datetime(2019, 3, 20),
)
for dt in date_period.range("days"):
start, end = dt.start_of("day"), dt.end_of("end")
print(start, end)
# 2019-02-16T00:00:00+00:00 2019-02-16T23:59:59.999999+00:00
# 2019-02-17T00:00:00+00:00 2019-02-17T23:59:59.999999+00:00
# 2019-02-18T00:00:00+00:00 2019-02-18T23:59:59.999999+00:00
# 2019-02-19T00:00:00+00:00 2019-02-19T23:59:59.999999+00:00
# 2019-02-20T00:00:00+00:00 2019-02-20T23:59:59.999999+00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment