Java Code Examples for org.joda.time.DateTimeConstants#WEDNESDAY

The following examples show how to use org.joda.time.DateTimeConstants#WEDNESDAY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Alarm.java    From prayer-times-android with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: Alarm.java    From prayer-times-android with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: TimeUtils.java    From LQRWeChat with MIT License 5 votes vote down vote up
/**
     * 得到仿微信日期格式输出
     *
     * @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));
        }
    }
 
Example 4
Source File: WeeklyWednesdayExpiryDayValidator.java    From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
protected int weekStarts() {
    return DateTimeConstants.WEDNESDAY;
}
 
Example 5
Source File: Jodatime.java    From maven-framework-project with MIT License 4 votes vote down vote up
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);
	
}