Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python、Google日历定义日期区域_Python_Date_Google Calendar Api - Fatal编程技术网

Python、Google日历定义日期区域

Python、Google日历定义日期区域,python,date,google-calendar-api,Python,Date,Google Calendar Api,我正在获取我的谷歌日历列表,但我想将收集限制在一个日期区域。我有这样一个“现在”: now = datetime.datetime.utcnow().isoformat() + 'Z' response = calendar.events().list(calendarId='primary', timeMin=now).execute() 我想要这样的东西: end = the end of the day of now 但我不知道怎么做,你知道吗? 我使用的列表如下: now = da

我正在获取我的谷歌日历列表,但我想将收集限制在一个日期区域。我有这样一个“现在”:

now = datetime.datetime.utcnow().isoformat() + 'Z'
response = calendar.events().list(calendarId='primary', timeMin=now).execute()
我想要这样的东西:

end = the end of the day of now
但我不知道怎么做,你知道吗? 我使用的列表如下:

now = datetime.datetime.utcnow().isoformat() + 'Z'
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(小时=0,分钟=0,秒=0)
为您提供当天的开始时间,然后添加24小时

谢谢大家!!但是你知道我是怎么回答的吗?因为没有timeMax,或者我找不到它……很明显,和你现在做的一样——在
end
上调用
.isoformat()
,追加
'Z'
,就是这样:
响应=calendar.events().list(calendarId='primary',timeMin=end.isoformat()+'Z')。执行();如果这不是你的意思,你需要更清楚地解释你的目标。好的,谢谢你,我想我必须有timeMin和timeMax作为回应!现在更清楚了!