當前位置: 首頁>>代碼示例>>Java>>正文


Java DateTimeConstants.SATURDAY屬性代碼示例

本文整理匯總了Java中org.joda.time.DateTimeConstants.SATURDAY屬性的典型用法代碼示例。如果您正苦於以下問題:Java DateTimeConstants.SATURDAY屬性的具體用法?Java DateTimeConstants.SATURDAY怎麽用?Java DateTimeConstants.SATURDAY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.joda.time.DateTimeConstants的用法示例。


在下文中一共展示了DateTimeConstants.SATURDAY屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDayOfWeekTimeFlag

public static long getDayOfWeekTimeFlag(int dayOfWeek) {
    dayOfWeek = (dayOfWeek - 1) % 7 + 1;
    switch (dayOfWeek) {
        case DateTimeConstants.SUNDAY:
            return FLAG_SUNDAY;

        case DateTimeConstants.MONDAY:
            return FLAG_MONDAY;

        case DateTimeConstants.SATURDAY:
            return FLAG_SATURDAY;

        case DateTimeConstants.WEDNESDAY:
            return FLAG_WEDNESDAY;

        case DateTimeConstants.TUESDAY:
            return FLAG_TUESDAY;

        case DateTimeConstants.THURSDAY:
            return FLAG_THURSDAY;
        case DateTimeConstants.FRIDAY:
            return FLAG_FRIDAY;

    }
    throw new IllegalArgumentException("dayOfWeek = " + dayOfWeek);
}
 
開發者ID:hyb1996,項目名稱:Auto.js,代碼行數:26,代碼來源:TimedTask.java

示例2: getDateOfCurrentMonday

private String getDateOfCurrentMonday() {
    DateTime currentDate = new DateTime();

    if (currentDate.getDayOfWeek() == DateTimeConstants.SATURDAY) {
        currentDate = currentDate.plusDays(2);
    } else if (currentDate.getDayOfWeek() == DateTimeConstants.SUNDAY) {
        currentDate = currentDate.plusDays(1);
    } else {
        currentDate = currentDate.withDayOfWeek(DateTimeConstants.MONDAY);
    }
    return currentDate.toString(DATE_PATTERN);
}
 
開發者ID:wulkanowy,項目名稱:wulkanowy,代碼行數:12,代碼來源:TimetableFragment.java

示例3: isMarketOpen

private boolean isMarketOpen(DateTime dateTime) {
  checkNotNull(dateTime);
  checkNotNullOrEmpty(forexCloseTime);
  checkNotNullOrEmpty(forexOpenTime);
  int dayOfWeek = dateTime.dayOfWeek().get();
  switch (dayOfWeek) {
    case DateTimeConstants.SATURDAY:
      return false;
    case DateTimeConstants.FRIDAY:
      DateTime marketCloseTime = DateTime.parse(forexCloseTime, DATE_TIME_FORMATTER)
          .plus(dateTime.withTimeAtStartOfDay().getMillis());
      return dateTime.compareTo(marketCloseTime) < 0;
    case DateTimeConstants.SUNDAY:
      DateTime marketOpenTime = DateTime.parse(forexOpenTime, DATE_TIME_FORMATTER)
          .plus(dateTime.withTimeAtStartOfDay().getMillis());
      return dateTime.compareTo(marketOpenTime) >= 0;
    case DateTimeConstants.MONDAY:
    case DateTimeConstants.TUESDAY:
    case DateTimeConstants.WEDNESDAY:
    case DateTimeConstants.THURSDAY:
      return true;
    default:
      throw new IllegalArgumentException(
          String.format("Unsupported day of the week [%d]", dayOfWeek));
  }
}
 
開發者ID:melphi,項目名稱:onplan,代碼行數:26,代碼來源:ServicesActivationJob.java

示例4: getMonthlyExpirations

/**
 * Gets all expirations for the current symbol and then excludes dates that are not part of the monthly expirations.
 * Dates are 15th - 22nd, if it's the 22nd, then the 22nd has to be a Sat
 * 
 * There are some expirations on Friday and Sat where 1 of the 2 only has a few options available.
 * 
 * @return monthly expirations
 */
public List<Date> getMonthlyExpirations() {
	
	List<Date> monthlyExpirations = new ArrayList<Date>();
	List<Date> allExpirations = getExpirations();
	
	for (Date date : allExpirations) {
		DateTime jDate = new DateTime(date);
		if (jDate.dayOfMonth().get() >=  15 && jDate.dayOfMonth().get() <= 22) {
			if ((jDate.dayOfMonth().get() == 22 && jDate.getDayOfWeek() != DateTimeConstants.SATURDAY)
					|| jDate.getDayOfWeek() == DateTimeConstants.SUNDAY
					|| jDate.getDayOfWeek() == DateTimeConstants.MONDAY
					|| jDate.getDayOfWeek() == DateTimeConstants.TUESDAY
					|| jDate.getDayOfWeek() == DateTimeConstants.WEDNESDAY
					|| jDate.getDayOfWeek() == DateTimeConstants.THURSDAY
					) {
				// skip
			} else {
				//System.out.println(jDate.toString() + " - " + jDate.getDayOfWeek());
				monthlyExpirations.add(date);
			}
		}
	}
	return monthlyExpirations;
}
 
開發者ID:dynoweb,項目名稱:optionTrader,代碼行數:32,代碼來源:ExpirationService.java

示例5: getExpanded

private boolean getExpanded(String dayDate) {
    DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(DATE_PATTERN);
    DateTime dayTime = dateTimeFormatter.parseDateTime(dayDate);

    DateTime currentDate = new DateTime();

    if (currentDate.getDayOfWeek() == DateTimeConstants.SATURDAY) {
        currentDate = currentDate.plusDays(2);
    } else if (currentDate.getDayOfWeek() == DateTimeConstants.SUNDAY) {
        currentDate = currentDate.plusDays(1);
    }

    return DateTimeComparator.getDateOnlyInstance().compare(currentDate, dayTime) == 0;
}
 
開發者ID:wulkanowy,項目名稱:wulkanowy,代碼行數:14,代碼來源:TimetableFragmentTab.java

示例6: getWeekday

/**
 * 計算當前是星期幾
 * 返回 星期x
 */
public static String getWeekday(Date date)
{
	DateTime dt = new DateTime(date);
	String weekday = "";
	//星期  
	switch(dt.getDayOfWeek()) {  
	case DateTimeConstants.SUNDAY:  
		weekday = "星期日";  
	    break;  
	case DateTimeConstants.MONDAY:  
		weekday = "星期一";  
	    break;  
	case DateTimeConstants.TUESDAY:  
		weekday = "星期二";  
	    break;  
	case DateTimeConstants.WEDNESDAY:  
		weekday = "星期三";  
	    break;  
	case DateTimeConstants.THURSDAY:  
		weekday = "星期四";  
	    break;  
	case DateTimeConstants.FRIDAY:  
		weekday = "星期五";  
	    break;  
	case DateTimeConstants.SATURDAY:  
		weekday = "星期六";  
	    break;  
	}  
	return weekday;
}
 
開發者ID:marlonwang,項目名稱:raven,代碼行數:34,代碼來源:DateUtils.java

示例7: getWeekday2

/** 返回 周x */
public static String getWeekday2(Date date)
{
  DateTime dt = new DateTime(date);
  String weekday = "";
  //星期  
  switch(dt.getDayOfWeek()) {  
  case DateTimeConstants.SUNDAY:  
    weekday = "周日";  
      break;  
  case DateTimeConstants.MONDAY:  
    weekday = "周一";  
      break;  
  case DateTimeConstants.TUESDAY:  
    weekday = "周二";  
      break;  
  case DateTimeConstants.WEDNESDAY:  
    weekday = "周三";  
      break;  
  case DateTimeConstants.THURSDAY:  
    weekday = "周四";  
      break;  
  case DateTimeConstants.FRIDAY:  
    weekday = "周五";  
      break;  
  case DateTimeConstants.SATURDAY:  
    weekday = "周六";  
      break;  
  }  
  return weekday;
}
 
開發者ID:marlonwang,項目名稱:raven,代碼行數:31,代碼來源:DateUtils.java

示例8: getEnWeekday

/** 返回 SUN,MON,TUE*/
public static String getEnWeekday(Date date)
{
	DateTime dt = new DateTime(date);
	String weekday = "";
	//星期  
	switch(dt.getDayOfWeek()) {  
	case DateTimeConstants.SUNDAY:  
		weekday = "SUN";  
	    break;  
	case DateTimeConstants.MONDAY:  
		weekday = "MON";  
	    break;  
	case DateTimeConstants.TUESDAY:  
		weekday = "TUE";  
	    break;  
	case DateTimeConstants.WEDNESDAY:  
		weekday = "WED";  
	    break;  
	case DateTimeConstants.THURSDAY:  
		weekday = "THU";  
	    break;  
	case DateTimeConstants.FRIDAY:  
		weekday = "FRI";  
	    break;  
	case DateTimeConstants.SATURDAY:  
		weekday = "SAT";  
	    break;  
	}  
	return weekday;
}
 
開發者ID:marlonwang,項目名稱:raven,代碼行數:31,代碼來源:DateUtils.java

示例9: getMsgFormatTime

/**
     * 得到仿微信日期格式輸出
     *
     * @param msgTimeMillis
     * @return
     */
    public static String getMsgFormatTime(long msgTimeMillis) {
        DateTime nowTime = new DateTime();
//        LogUtils.sf("nowTime = " + nowTime);
        DateTime msgTime = new DateTime(msgTimeMillis);
//        LogUtils.sf("msgTime = " + msgTime);
        int days = Math.abs(Days.daysBetween(msgTime, nowTime).getDays());
//        LogUtils.sf("days = " + days);
        if (days < 1) {
            //早上、下午、晚上 1:40
            return getTime(msgTime);
        } else if (days == 1) {
            //昨天
            return "昨天 " + getTime(msgTime);
        } else if (days <= 7) {
            //星期
            switch (msgTime.getDayOfWeek()) {
                case DateTimeConstants.SUNDAY:
                    return "周日 " + getTime(msgTime);
                case DateTimeConstants.MONDAY:
                    return "周一 " + getTime(msgTime);
                case DateTimeConstants.TUESDAY:
                    return "周二 " + getTime(msgTime);
                case DateTimeConstants.WEDNESDAY:
                    return "周三 " + getTime(msgTime);
                case DateTimeConstants.THURSDAY:
                    return "周四 " + getTime(msgTime);
                case DateTimeConstants.FRIDAY:
                    return "周五 " + getTime(msgTime);
                case DateTimeConstants.SATURDAY:
                    return "周六 " + getTime(msgTime);
            }
            return "";
        } else {
            //12月22日
            return msgTime.toString("MM月dd日 " + getTime(msgTime));
        }
    }
 
開發者ID:starryxp,項目名稱:LQRWeChat-master,代碼行數:43,代碼來源:TimeUtils.java

示例10: WORKDAY

/**
 * Returns a date a number of workdays away. Saturday and Sundays are not considered working days.
 */
@Function("WORKDAY")
@FunctionParameters({
	@FunctionParameter("dateObject"),
	@FunctionParameter("workdays")})
public Date WORKDAY(Object dateObject, Integer workdays){
	Date convertedDate = convertDateObject(dateObject);
	if(convertedDate==null){
		logCannotConvertToDate();
		return null;
	}
	else{
		boolean lookBack = workdays<0;
		DateTime cursorDT=new DateTime(convertedDate);
		int remainingDays=Math.abs(workdays);
		while(remainingDays>0){
			int dayOfWeek = cursorDT.getDayOfWeek();
			if(!(dayOfWeek==DateTimeConstants.SATURDAY || 
					dayOfWeek==DateTimeConstants.SUNDAY)){
				// Decrement remaining days only when it is not Saturday or Sunday
				remainingDays--;
			}
			if(!lookBack) {
				cursorDT= dayOfWeek==DateTimeConstants.FRIDAY?cursorDT.plusDays(3):cursorDT.plusDays(1);
			}
			else {
				cursorDT= dayOfWeek==DateTimeConstants.MONDAY?cursorDT.minusDays(3):cursorDT.minusDays(1);
			}
		}
		return cursorDT.toDate();
	}
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:34,代碼來源:DateTimeFunctions.java

示例11: NETWORKDAYS

/**
 * Returns the number of working days between two dates (inclusive). Saturday and Sunday are not considered working days.
 */
@Function("NETWORKDAYS")
@FunctionParameters({
	@FunctionParameter("startDate"),
	@FunctionParameter("endDate")})
public Integer NETWORKDAYS(Object startDate, Object endDate){
	Date startDateObj = convertDateObject(startDate);
	if(startDateObj==null) {
		logCannotConvertToDate();
		return null;
	}
	Date endDateObj = convertDateObject(endDate);
	if(endDateObj==null){
		logCannotConvertToDate();
		return null;
	}
	else{
		LocalDate cursorLocalDate=new LocalDate(startDateObj);
		LocalDate endLocalDate=new LocalDate(endDateObj);
		int workingDays=0;
		if(cursorLocalDate.isAfter(endLocalDate)){
			// Swap data information
			LocalDate tmp=cursorLocalDate;
			cursorLocalDate=endLocalDate;
			endLocalDate=tmp;
		}
		while (Days.daysBetween(cursorLocalDate, endLocalDate).getDays()>0){
			int dayOfWeek = cursorLocalDate.getDayOfWeek();
			if(!(dayOfWeek==DateTimeConstants.SATURDAY || 
					dayOfWeek==DateTimeConstants.SUNDAY)){
				workingDays++;
			}
			cursorLocalDate=cursorLocalDate.plusDays(1);
		}
		return workingDays;
	}
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:39,代碼來源:DateTimeFunctions.java

示例12: parseShowReleaseWeekDay

/**
 * Converts US week day string to {@link org.joda.time.DateTimeConstants} day.
 *
 * <p> Returns -1 if no conversion is possible and 0 if it is "Daily".
 */
public static int parseShowReleaseWeekDay(String day) {
    if (day == null || day.length() == 0) {
        return -1;
    }

    // catch Monday through Sunday
    switch (day) {
        case "Monday":
            return DateTimeConstants.MONDAY;
        case "Tuesday":
            return DateTimeConstants.TUESDAY;
        case "Wednesday":
            return DateTimeConstants.WEDNESDAY;
        case "Thursday":
            return DateTimeConstants.THURSDAY;
        case "Friday":
            return DateTimeConstants.FRIDAY;
        case "Saturday":
            return DateTimeConstants.SATURDAY;
        case "Sunday":
            return DateTimeConstants.SUNDAY;
        case "Daily":
            return 0;
    }

    // no match
    return -1;
}
 
開發者ID:tasomaniac,項目名稱:MuzeiTVShows,代碼行數:33,代碼來源:TimeTools.java

示例13: getNYSEInfo

public static String getNYSEInfo(Context context){
    DateTimeZone nyTZ = DateTimeZone.forID("America/New_York");
    DateTime now = new DateTime(nyTZ);
    int[] daysHoursMinutes;
    switch (now.getDayOfWeek()){
        case DateTimeConstants.SATURDAY:
            DateTime temp = now.plusDays(2);
            DateTime nextTradeStart = new DateTime(temp.getYear(), temp.getMonthOfYear(),
                    temp.getDayOfMonth(), 9, 30, nyTZ);
            temp = nextTradeStart.minus(now.getMillis());
            daysHoursMinutes = getDaysHoursMinutes(temp.getMillis());
            return String.format(context.getString(R.string.nyse_is_closed), daysHoursMinutes[0],
                    daysHoursMinutes[1], daysHoursMinutes[2]);
        case DateTimeConstants.SUNDAY:
            temp = now.plusDays(1);
            nextTradeStart = new DateTime(temp.getYear(), temp.getMonthOfYear(),
                    temp.getDayOfMonth(), 9, 30, nyTZ);
            temp = nextTradeStart.minus(now.getMillis());
            daysHoursMinutes = getDaysHoursMinutes(temp.getMillis());
            return String.format(context.getString(R.string.nyse_is_closed), daysHoursMinutes[0],
                    daysHoursMinutes[1], daysHoursMinutes[2]);
        default:
            nextTradeStart = new DateTime(now.getYear(), now.getMonthOfYear(),
                    now.getDayOfMonth(), 9, 30, nyTZ);
            DateTime nextTradeEnd = new DateTime(now.getYear(), now.getMonthOfYear(),
                    now.getDayOfMonth(), 16, 0, nyTZ);
            if(now.isBefore(nextTradeStart.getMillis())){
                temp = nextTradeStart.minus(now.getMillis());
                daysHoursMinutes = getDaysHoursMinutes(temp.getMillis());
                return String.format(context.getString(R.string.nyse_is_closed), daysHoursMinutes[0],
                        daysHoursMinutes[1], daysHoursMinutes[2]);
            }
            if (now.isAfter(nextTradeEnd.getMillis())){
                temp = nextTradeStart.plusDays(1).minus(now.getMillis());
                daysHoursMinutes = getDaysHoursMinutes(temp.getMillis());
                return String.format(context.getString(R.string.nyse_is_closed), daysHoursMinutes[0],
                        daysHoursMinutes[1], daysHoursMinutes[2]);
            }
            temp = nextTradeEnd.minus(now.getMillis());
            daysHoursMinutes = getDaysHoursMinutes(temp.getMillis());
            return String.format(context.getString(R.string.nyse_is_open), daysHoursMinutes[0],
                    daysHoursMinutes[1], daysHoursMinutes[2]);
    }
}
 
開發者ID:romanchekashov,項目名稱:currency-and-stock-widget,代碼行數:44,代碼來源:Utils.java

示例14: dayOfWeekToString

public static String dayOfWeekToString(Integer dayOfWeek) {
  if (dayOfWeek==null) return "unspecified day";
  else if (dayOfWeek==DateTimeConstants.MONDAY) return "Monday"; // 1
  else if (dayOfWeek==DateTimeConstants.TUESDAY) return "Tuesday"; // 2
  else if (dayOfWeek==DateTimeConstants.WEDNESDAY) return "Wednesday"; // 3
  else if (dayOfWeek==DateTimeConstants.THURSDAY) return "Thursday"; // 4
  else if (dayOfWeek==DateTimeConstants.FRIDAY) return "Friday"; // 5
  else if (dayOfWeek==DateTimeConstants.SATURDAY) return "Saturday"; // 6
  else if (dayOfWeek==DateTimeConstants.SUNDAY) return "Sunday"; // 7
  return "invalid day of the week "+dayOfWeek;
}
 
開發者ID:effektif,項目名稱:effektif,代碼行數:11,代碼來源:NextRelativeTime.java

示例15: isWeekend

@Override
public boolean isWeekend(DateTime day) {
	return day.getDayOfWeek() == DateTimeConstants.SATURDAY || day.getDayOfWeek() == DateTimeConstants.SUNDAY;
}
 
開發者ID:adessoAG,項目名稱:JenkinsHue,代碼行數:4,代碼來源:HoldayServiceImpl.java


注:本文中的org.joda.time.DateTimeConstants.SATURDAY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。