LocalTime currentTime = LocalTime.now();
public class MeetingRoomBooking {
private LocalTime startTime;
private LocalTime endTime;
public boolean hasConflict(MeetingRoomBooking other) {
return !(this.endTime.isBefore(other.startTime) ||
this.startTime.isAfter(other.endTime));
}
}
public LocalTime convertToTargetTimeZone(LocalTime sourceTime, ZoneId sourceZone, ZoneId targetZone) {
// 假设源时间是某时区的上午9点
ZonedDateTime sourceZoned = ZonedDateTime.of(
LocalDate.now(), sourceTime, sourceZone
);
ZonedDateTime targetZoned = sourceZoned.withZoneSameInstant(targetZone);
return targetZoned.toLocalTime();
}