DateUtil { public static Time time(DateTime dateTime) { return new Time(dateTime.getHourOfDay(), dateTime.getMinuteOfHour()); } private  DateUtil(); static DateTime now(); static DateTime nowUTC(); static LocalDate today(); static LocalDate tomorrow(); static LocalDate newDate(int year, int month, int day); static DateTime newDateTime(LocalDate localDate, int hour, int minute, int second); static DateTime setTimeZone(DateTime dateTime); static DateTime setTimeZoneUTC(DateTime dateTime); static DateTime newDateTime(Date date); static DateTime newDateTime(LocalDate date); static Time time(DateTime dateTime); static LocalDate newDate(Date date); static LocalDate newDate(DateTime dateTime); static int daysPast(LocalDate localDate, DayOfWeek dayOfWeek); static boolean isOnOrBefore(DateTime firstDate, DateTime secondDate); static boolean isOnOrAfter(DateTime firstDate, DateTime secondDate); static boolean inRange(DateTime reference, DateTime start, DateTime end); static int daysToCalendarWeekEnd(LocalDate date, int calendarWeekStartDay); static DateTime newDateTime(LocalDate localDate, Time time); static DateTime newDateTime(int year, int month, int day, Time time); static DateTime newDateTime(int year, int month, int day); static DateTime newDateTime(int year, int month, int day, int hour, int minute, int second); static int getDifferenceOfDatesInYears(Date startDate); static DateTime endOfDay(Date dateTime); static DateTime nextApplicableWeekDay(DateTime fromDate, List<DayOfWeek> applicableDays); static DateTime nextApplicableWeekDayIncludingFromDate(DateTime fromDate, List<DayOfWeek> applicableDays); static List<DateTime> greaterThanOrEqualTo(final DateTime date, final List<DateTime> dates); static List<DateTime> lessThan(final DateTime date, final List<DateTime> dates); static List<DayOfWeek> daysStarting(DayOfWeek day, int numberOfDays); static List<DateTime> datesToDateTimes(List<Date> dates); static Date toDate(DateTime dateTime); static DateTime toDateTimeAtStartOfDay(LocalDate localDate);  }
@Test public void shouldReturnTimeFromDateTime() { assertThat(DateUtil.time(new DateTime(2012, 12, 2, 19, 9, 38)), is(new Time(19, 9))); assertThat(DateUtil.time(new DateTime(2012, 12, 2, 1, 58, 57)), is(new Time(1, 58))); }