Get the weekday of date

@param date current date
@return day of week
10526
public static int getWeekdayOfDate(String date) {
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
		int weekday = 0;
		Calendar c = Calendar.getInstance();
		try {
			c.setTime(formatter.parse(date));
			weekday = c.get(Calendar.DAY_OF_WEEK);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return weekday;
	}
665930
public static Calendar getCal(final Date date) {
        if (date == null) {
            return null;
        }
        final Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        return blastTime(cal);
    }
76258
public static int getDay(final Date date)
	{
		final Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);
		return calendar.get(Calendar.DAY_OF_MONTH);
	}
1284581
public ProjectCalendarWeek getWorkWeek(Date date)
   {
      ProjectCalendarWeek week = null;
      if (!m_workWeeks.isEmpty())
      {
         sortWorkWeeks();

         int low = 0;
         int high = m_workWeeks.size() - 1;
         long targetDate = date.getTime();

         while (low <= high)
         {
            int mid = (low + high) >>> 1;
            ProjectCalendarWeek midVal = m_workWeeks.get(mid);
            int cmp = 0 - DateHelper.compare(midVal.getDateRange().getStart(), midVal.getDateRange().getEnd(), targetDate);

            if (cmp < 0)
            {
               low = mid + 1;
            }
            else
            {
               if (cmp > 0)
               {
                  high = mid - 1;
               }
               else
               {
                  week = midVal;
                  break;
               }
            }
         }
      }

      if (week == null && getParent() != null)
      {
         // Check base calendar as well for a work week.
         week = getParent().getWorkWeek(date);
      }
      return (week);
   }
1373418
public static Integer getDayOfWeek(Date date) {

        if (date == null)
            return null;

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);

        return calendar.get(Calendar.DAY_OF_WEEK);
    }
364926
function getYearWeek (date) {
  date = toStringDate(date)
  if (baseExports.isDate(date)) {
    date.setHours(0, 0, 0, 0)
    date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7)
    var week = new Date(date.getFullYear(), 0, 4)
    return Math.round(((date.getTime() - week.getTime()) / DAY_TIME + (week.getDay() + 6) % 7 - 3) / 7) + 1
  }
  return date
}
573594
def weekly(date=datetime.date.today()):
    
    return date - datetime.timedelta(days=date.weekday())
762842
function(date) {
		var checkDate = new Date(date.getTime());
		// Find Thursday of this week starting on Monday
		checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
		var time = checkDate.getTime();
		checkDate.setMonth(0); // Compare with Jan 1
		checkDate.setDate(1);
		return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
	}
991198
public static int getDayOfYear(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        return c.get(Calendar.DAY_OF_YEAR);
    }
583279
function getWeekNumber(day) {
  var date = clone(day);
  date.setHours(0, 0, 0);
  date.setDate(date.getDate() + 4 - (date.getDay() || 7));
  return Math.ceil(((date - new Date(date.getFullYear(), 0, 1)) / 8.64e7 + 1) / 7);
}
1174423
private int getDaysToNextMatch(WeekDay weekDay) {

        for (WeekDay wd : m_weekDays) {
            if (wd.compareTo(weekDay) > 0) {
                return wd.toInt() - weekDay.toInt();
            }
        }
        return (m_weekDays.iterator().next().toInt() + (m_interval * I_CmsSerialDateValue.NUM_OF_WEEKDAYS))
            - weekDay.toInt();
    }
596753
public static long getDayOfWeekDateOnOrBefore(long fixedDate, int dayOfWeek) {
        long fd = fixedDate - (dayOfWeek - 1);
        if (fd >= 0) {
            return fixedDate - (fd % 7);
        }
        return fixedDate - CalendarUtils.mod(fd, 7);
    }
914017
public static int getHours(final Date date)
	{
		final Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);
		return calendar.get(Calendar.HOUR_OF_DAY);
	}
673797
public Weekday getDayOfWeek() {

        long utcDays = CALSYS.transform(this);
        return Weekday.valueOf(MathUtils.floorModulo(utcDays + 5, 7) + 1);

    }
1028370
public static Date getFirstDayFromCurrentWeek(Date d) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(d);        
        cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        return cal.getTime();
    }
1357288
private static int getWeekOfYear(PlainDate date) {

        int dayOfYear = date.getDayOfYear();
        int wCurrent = getFirstCalendarWeekAsDayOfYear(date, 0);

        if (wCurrent <= dayOfYear) {
            int result = ((dayOfYear - wCurrent) / 7) + 1;

            if (result >= 53) { // Optimierung
                int wNext =
                    getFirstCalendarWeekAsDayOfYear(date, 1)
                    + getLengthOfYear(date, 0);
                if (wNext <= dayOfYear) {
                    result = 1;
                }
            }

            return result;
        } else {
            int wPrevious = getFirstCalendarWeekAsDayOfYear(date, -1);
            int dayCurrent = dayOfYear + getLengthOfYear(date, -1);
            return ((dayCurrent - wPrevious) / 7) + 1;
        }

    }
403551
public static Integer getDayOfSeason(Date date) {

        if (date == null)
            return null;

        int day = 0;
        Date[] seasonDates = getSeasonDate(date);
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        int month = c.get(Calendar.MONTH);
        if (month == Calendar.JANUARY || month == Calendar.APRIL || month == Calendar.JULY || month == Calendar.OCTOBER) {// 季度第一个月
            day = getDayOfMonth(seasonDates[0]);
        } else if (month == Calendar.FEBRUARY || month == Calendar.MAY || month == Calendar.AUGUST || month == Calendar.NOVEMBER) {// 季度第二个月
            day = getDayOfMonth(seasonDates[0])	+ getDayOfMonth(seasonDates[1]);
        } else if (month == Calendar.MARCH || month == Calendar.JUNE || month == Calendar.SEPTEMBER || month == Calendar.DECEMBER) {// 季度第三个月
            day = getDayOfMonth(seasonDates[0]) + getDayOfMonth(seasonDates[1])	+ getDayOfMonth(seasonDates[2]);
        }
        return day;
    }