我有两个不同的日历。我需要在Option
和Option
之间进行转换。这样做的最佳方法是什么?
也许Quartz库中有一些转换器?
答案 0 :(得分:0)
You may need to have two java.util.Calendars for each DailyCalendar, one that is set to the start time, and one that is set to the end time.
Converting from two java.util.Calendar objects to one DailyCalendar object:
java.util.Calendar start = Calendar.getInstance();
start.setTimeInMillis(System.currentTimeMillis() - 360000); // an hour ago
java.util.Calendar end = Calendar.getInstance();
end.setTimeInMillis(System.currentTimeMillis()); // now
DailyCalendar dc = new DailyCalendar(start.getTimeInMillis(), end.getTimeInMillis());
Converting back:
start.setTimeInMillis(dc.getTimeRangeStartingTimeInMillis());
end.setTimeInMillis(getTimeRangeEndingTimeInMillis());