This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Google Calendar Lower Bounds for Start Time

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there it's my first time using an API. I'm having a little trouble with the google calendar api. What i have is after a event gets printed out it gets the next event



The above is code to get the next event. But my problem is this:



The problem is when i run it, it says the next event is "example event". For me the next event should be "2nd event" because the start time of "example event" has already passed.

In the api there is a timeMax:


Timemax is the upper bounds of the start time. But what I really need is the lower bounds of the start time and the api doesn't have that.

Link to full list of parameters in the api: https://developers.google.com/google-apps/calendar/v3/reference/events/list

If my start time is [lower bounds, upper bounds] I want [the time now, upperbounds]

I guess a possible solution would be to get not just the "next event" but get like the "next 10 events". Then have a comparater to check if the event's start time (which i can get after i retrieve the events) is less than the current time.

If not get the "next event"

I'm just thinking worst case if all 10 events start before the start time and the 11th event starts after then the 11th event wouldn't get retrieved.

I'd have to use the list method with a query of 20 and repeat to get the "next 20 events" and perhaps have a counter on the last position (10).

I might also need to have an event in like 2050 or something so there will also be an event in the future.

Is that the best solution for this?
 
Glenn Jayasuriya
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm just going to try my solution.
I'll post how it goes here later.
I can always just convert to a diff solution later as well.
 
Glenn Jayasuriya
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My solution works.
Might not be the best solution, but gets the job done.
Set the range to 20 and filter for what i want.
 
Crusading Chameleon likes the size of this ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!