0

I'm trying to use NetBeans to set up a meeting between 2 people where the users input their name & location as well as their availabilities to call on specified days of the week where the program outputs the possible times to call to each user in their respective time zones.

I started creating the Person & Scheduler classes on BlueJ and attempted to convert the hours to minutes and output the times but I'm having trouble with the timezones and using NetBeans.

mlij123
  • 3
  • 2
  • Can you show us the code you have trouble with? – deHaar Nov 04 '19 at 13:26
  • Do you mean specific dates? Or do you mean day-of-week for any number of weeks? – Basil Bourque Nov 05 '19 at 04:33
  • with no specific dates, including every day of the week as it does not necessarily have to be a business meeting so it could be a simple call between friends for example – mlij123 Nov 05 '19 at 14:14
  • i’m not really sure where to start with the code when i have to convert between time zones ... this is for a school assignment and it’s the first time we’re using any GUI so it’s all really confusing for me – mlij123 Nov 05 '19 at 14:16
  • Can the time when available cross over between days, over midnight? – Basil Bourque Nov 06 '19 at 00:28
  • no, the time when available would be within the 24 hours in a day – mlij123 Nov 07 '19 at 04:41

1 Answers1

0

When dealing with different time zones in the future (i.e. the rules for calculating the final time may change) you can take the following strategy:

Save the time that the meeting organizer selects using the local time zone. This is permanent. The first time, and every time the time zone rules changes (does not happen that often in most countries) you: Convert the meeting time to UTC. For each meeting participant you convert the time to the persons local time zone.

Only use standard library methods for this. Do not try to do any time math yourself, because most people in the World would make a mistake.

In Java use the new Time and Date API if at all possible. That is do not use the Date but use Instant, ZonedDateTime etc. The new API has much less errors and makes it harder to make some yourself. Time and time zones is a place where mistakes are very easily made.