List of usage examples for org.joda.time ReadableDateTime getDayOfWeek
int getDayOfWeek();
From source file:com.ning.metrics.serialization.util.DateTimeUtil.java
License:Apache License
public DateTime truncateToWeek(ReadableDateTime time) { MutableDateTime result = new MutableDateTime(time); result.setMillisOfSecond(0);// w ww.j a v a 2 s . com result.setSecondOfMinute(0); result.setMinuteOfHour(0); result.setHourOfDay(0); result.setHourOfDay(0); if (time.getDayOfWeek() != 7) { result.setDayOfWeek(1); result.add(Days.ONE.multipliedBy(-1)); } return new DateTime(result); }
From source file:com.phloc.datetime.PDTUtils.java
License:Apache License
public static boolean isWeekend(@Nonnull final ReadableDateTime aDT) { return isWeekendDay(aDT.getDayOfWeek()); }
From source file:com.phloc.datetime.PDTUtils.java
License:Apache License
public static boolean isFirstDayOfWeek(@Nonnull final ReadableDateTime aDT) { return isFirstDayOfWeek(aDT.getDayOfWeek()); }
From source file:com.phloc.datetime.PDTUtils.java
License:Apache License
public static boolean isLastDayOfWeek(@Nonnull final ReadableDateTime aDT) { return isLastDayOfWeek(aDT.getDayOfWeek()); }
From source file:org.softdays.mandy.service.support.CalendarServiceImpl.java
License:Open Source License
private boolean isMonday(final ReadableDateTime date) { return date.getDayOfWeek() == DateTimeConstants.MONDAY; }
From source file:org.softdays.mandy.service.support.CalendarServiceImpl.java
License:Open Source License
/** * Checks if is end of week.//from w ww . ja va 2s .c om * * @param givenDate * the given date * @return true, if is end of week */ protected boolean isEndOfWeek(final ReadableDateTime date) { final int dayOfWeek = date.getDayOfWeek(); return dayOfWeek == DateTimeConstants.SUNDAY || dayOfWeek == DateTimeConstants.SATURDAY; }