Exercise: International Meeting Scheduler
Problem statement
A CEO based in London is scheduling a global all-hands meeting. The meeting is set for a specific absolute moment in time. You need to build a utility method that calculates the exact local clock time for any regional office when provided with their specific time zone identifier.
Task requirements
Implement the
GetLocalMeetingTimemethod in theMeetingSchedulerclass within theCorporatenamespace.Load the time zone rules using the provided
timeZoneIdparameter.Calculate and return the equivalent local time for that specific time zone.
Constraints
Use
TimeZoneInfo.FindSystemTimeZoneByIdto load the time zone rules dynamically based on the passed string.Use
TimeZoneInfo.ConvertTimeto convert the UTC meeting time into the localized regionalDateTimeOffset.Return the localized
DateTimeOffsetfrom the utility method.
Good luck trying the exercise! If you’re unsure how to proceed, check the “Solution” tab above.
Get hints
The
TimeZoneInfo.FindSystemTimeZoneByIdmethod expects the exacttimeZoneIdstring passed into your utility method.The
TimeZoneInfo.ConvertTimemethod requires the originalDateTimeOffsetand the targetTimeZoneInfoobject as arguments.Ensure you return the newly calculated
DateTimeOffsetrather than the original UTC value.
Exercise: International Meeting Scheduler
Problem statement
A CEO based in London is scheduling a global all-hands meeting. The meeting is set for a specific absolute moment in time. You need to build a utility method that calculates the exact local clock time for any regional office when provided with their specific time zone identifier.
Task requirements
Implement the
GetLocalMeetingTimemethod in theMeetingSchedulerclass within theCorporatenamespace.Load the time zone rules using the provided
timeZoneIdparameter.Calculate and return the equivalent local time for that specific time zone.
Constraints
Use
TimeZoneInfo.FindSystemTimeZoneByIdto load the time zone rules dynamically based on the passed string.Use
TimeZoneInfo.ConvertTimeto convert the UTC meeting time into the localized regionalDateTimeOffset.Return the localized
DateTimeOffsetfrom the utility method.
Good luck trying the exercise! If you’re unsure how to proceed, check the “Solution” tab above.
Get hints
The
TimeZoneInfo.FindSystemTimeZoneByIdmethod expects the exacttimeZoneIdstring passed into your utility method.The
TimeZoneInfo.ConvertTimemethod requires the originalDateTimeOffsetand the targetTimeZoneInfoobject as arguments.Ensure you return the newly calculated
DateTimeOffsetrather than the original UTC value.