Bus schedule/timetable
Posted: Mon Feb 21, 2011 6:02 pm
Hi everyone,
I have to implement bus time table in this way:
Every bus drives every second day from the day chosen.
Let's say: If xx bus goes every second day from 23rd February to 30th June to Spain (23rd, 25th, 27th...),
How can I check if let's say on 14th May there is bus to Spain?
I started with odd and even numbers: if it starts from the even day than there is array of months with number of days, but what if Feb has 29days (every 4th year) instead of 28... I'm totally confused here.
Is there any other way of implementing this?
I have to implement bus time table in this way:
Every bus drives every second day from the day chosen.
Let's say: If xx bus goes every second day from 23rd February to 30th June to Spain (23rd, 25th, 27th...),
How can I check if let's say on 14th May there is bus to Spain?
I started with odd and even numbers: if it starts from the even day than there is array of months with number of days, but what if Feb has 29days (every 4th year) instead of 28... I'm totally confused here.
Is there any other way of implementing this?