我正在使用Google Calendar API和Google Client Library for Python。我使用的代码给出了在给定日期范围内但没有时间的事件列表。我想要一个输出,它给出事件列表和时间。这是代码:
page_token = None
while True:
events = service.events().list(calendarId='primary',pageToken=page_token,
timeMin='2014-06-03T00:00:00+05:30',
timeMax='2014-06-05T00:00:00+05:30').execute()
print 'Daterange for events in primary calendar:2014-06-03 and 2014-06-05'
for event in events['items']:
print event['summary']
page_token = events.get('nextPageToken')
if not page_token:
break
关于添加print event ['start']和print event ['end'],我确实得到以下格式的输出
Start time: {u'dateTime': u'2014-06-03T09:00:00-04:00'}
End time: {u'dateTime': u'2014-06-03T10:00:00-04:00'}
我希望它像:
Start time: DATE:23/05/2014 TIME: 01:00PM
End time: DATE:23/05/2014 TIME: 02:00PM
请建议一种方法。
非常感谢!