org.joda.time.DateTimeConstants#SATURDAY源码实例Demo

下面列出了org.joda.time.DateTimeConstants#SATURDAY 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: prayer-times-android   文件: Alarm.java
private static int jodaWDToJavaWD(int wd) {
    switch (wd) {
        case DateTimeConstants.MONDAY:
            return Calendar.MONDAY;
        case DateTimeConstants.TUESDAY:
            return Calendar.TUESDAY;
        case DateTimeConstants.WEDNESDAY:
            return Calendar.WEDNESDAY;
        case DateTimeConstants.THURSDAY:
            return Calendar.THURSDAY;
        case DateTimeConstants.FRIDAY:
            return Calendar.FRIDAY;
        case DateTimeConstants.SATURDAY:
            return Calendar.SATURDAY;
        case DateTimeConstants.SUNDAY:
            return Calendar.SUNDAY;
    }
    return 0;
}
 
源代码2 项目: prayer-times-android   文件: Alarm.java
private static int jodaWDToJavaWD(int wd) {
    switch (wd) {
        case DateTimeConstants.MONDAY:
            return Calendar.MONDAY;
        case DateTimeConstants.TUESDAY:
            return Calendar.TUESDAY;
        case DateTimeConstants.WEDNESDAY:
            return Calendar.WEDNESDAY;
        case DateTimeConstants.THURSDAY:
            return Calendar.THURSDAY;
        case DateTimeConstants.FRIDAY:
            return Calendar.FRIDAY;
        case DateTimeConstants.SATURDAY:
            return Calendar.SATURDAY;
        case DateTimeConstants.SUNDAY:
            return Calendar.SUNDAY;
    }
    return 0;
}
 
源代码3 项目: LQRWeChat   文件: TimeUtils.java
/**
     * 得到仿微信日期格式输出
     *
     * @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));
        }
    }
 
源代码4 项目: jasperreports   文件: DateTimeFunctions.java
/**
 * 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();
	}
}
 
源代码5 项目: jasperreports   文件: DateTimeFunctions.java
/**
 * 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;
	}
}
 
@Override
protected int weekStarts() {
    return DateTimeConstants.SATURDAY;
}
 
源代码7 项目: maven-framework-project   文件: Jodatime.java
private static void getTimeInfo(){
	
	System.out.println("-------------获取当前时间-----------------");
	
	String weekStr="";
	
	DateTime dt = new DateTime();
	//年
	int year = dt.getYear();
	//月
	int month = dt.getMonthOfYear();
	//日
	int day = dt.getDayOfMonth();
	//星期
	int week = dt.getDayOfWeek();
	//点
	int hour = dt.getHourOfDay();
	//分
	int min = dt.getMinuteOfHour();
	//秒
	int sec = dt.getSecondOfMinute();
	//毫秒
	int msec = dt.getMillisOfSecond();
	
	//星期
	switch(week) {
	case DateTimeConstants.SUNDAY:
		weekStr = "星期日";
		System.out.println(weekStr);
		break;
	case DateTimeConstants.MONDAY:
		weekStr = "星期一";
		System.out.println(weekStr);
		break;
	case DateTimeConstants.TUESDAY:
		weekStr = "星期二";
		System.out.println(weekStr);
		break;
	case DateTimeConstants.WEDNESDAY:
		weekStr = "星期三";
		System.out.println(weekStr);
		break;
	case DateTimeConstants.THURSDAY:
		weekStr = "星期四";
		System.out.println(weekStr);
		break;
	case DateTimeConstants.FRIDAY:
		weekStr = "星期五";
		System.out.println(weekStr);
		break;
	case DateTimeConstants.SATURDAY:
		weekStr = "星期六";
		System.out.println(weekStr);
		break;
	}
	
	System.out.println(year + "/" + month + "/" + day + " " + hour + ":" + min + ":" + sec + ":" + msec + " " + weekStr);
	
}