Python、Google 日历定义日期区

Python, Google Calendar define a datezone

我正在获取我的 Google 日历列表,但我想将集合限制在一个日期区内。我有一个 "now" 这样的:

now = datetime.datetime.utcnow().isoformat() + 'Z'

我想要这样的东西:

end = the end of the day of now

但我不知道该怎么做,你知道吗? 我正在使用这样的列表:

response = calendar.events().list(calendarId='primary', timeMin=now).execute()

谢谢!

end = datetime.datetime.utcnow().replace(hour=0, minute=0,second=0) + datetime.timedelta(hours=24)

datetime.datetime.utcnow().replace(hour=0, minute=0,second=0)给你这一天的开始,然后你加上24小时。