1

My problem is the OutPut that Google Calendar's code gives me. If I tell my program to output the next 10 events in a label he shows me only the last (ins't the problem itself though) like :

Event YYYY-MM-DDTHH:MM:SS.Z which would be okay, but I need it to look something like:

Event DD MM (preferably formatted as ('%a %d') 'cause the year is obvious).

WHAT I KNOW

In google's code is this:

for event in events:
    start = event['start'].get('dateTime', event['start'].get('date'))

the problem occurs (I think) in the .get('dateTime'
I did a print (events) and besides a bunch of useless code I got this: 'start': {'dateTime': '2018-04-03T15:30:00+02:00'}, 'end': {'dateTime': '2018-04-03T16:30:00+02:00'}. Supposedly when I print the events I print that section of 'dateTime' as it's written there.

Now, how do I tell python to print ONLY the ninth, tenth, sixth and seventh character from the dateTime he extracts?

If any clarification is needed please tell me.

  • Google calendar returns your date as as string its your job to format it as you see fit. if it helps the string formatting is formatted according to [RFC3339](https://tools.ietf.org/html/rfc3339) – Linda Lawton - DaImTo Feb 22 '18 at 10:34
  • 1
    In that case I think you could say that, didn't really know myself what I was asking, thanks for clarifying. –  Feb 22 '18 at 10:37
  • Google APis can be a bit confusing. Just remember everything is returned to you as a string. Makes it easier for you to format it later :) – Linda Lawton - DaImTo Feb 22 '18 at 10:38

0 Answers0