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


Java Date.getDay方法代碼示例

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


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

示例1: getWeekDay

import java.util.Date; //導入方法依賴的package包/類
public static String getWeekDay(Date date) {
    switch (date.getDay()) {
        case 0:
            return "星期日";
        case 1:
            return "星期一";
        case 2:
            return "星期二";
        case 3:
            return "星期三";
        case 4:
            return "星期四";
        case 5:
            return "星期五";
        case 6:
            return "星期六";
        default:
            return "星期一";
    }
}
 
開發者ID:Mindjet,項目名稱:LiteReader,代碼行數:21,代碼來源:DateUtil.java

示例2: getSectionIndices

import java.util.Date; //導入方法依賴的package包/類
private int[] getSectionIndices() {
	ArrayList<Integer> sectionIndices = new ArrayList<Integer>();
	if(mSignLogList.isEmpty()){
		return null;
	}
	Date lastFirstDate = DateUtil.getDateFromLong(mSignLogList.get(0).getTime());
	sectionIndices.add(0);
	int year = lastFirstDate.getYear();
	int month = lastFirstDate.getMonth();
	int date = lastFirstDate.getDay();
	for (int i = 1; i < mSignLogList.size(); i++) {
		Date dateTemp = DateUtil.getDateFromLong(mSignLogList.get(i).getTime());
		int year_temp = dateTemp.getYear();
		int month_temp = dateTemp.getMonth();
		int date_temp = dateTemp.getDay();
		if (year == year_temp && month_temp == month && date_temp == date) {
			continue;
		} else {
			lastFirstDate = DateUtil.getDateFromLong(mSignLogList.get(i).getTime());
			year = lastFirstDate.getYear();
			month = lastFirstDate.getMonth();
			date = lastFirstDate.getDay();
			sectionIndices.add(i);
		}
	}
	int[] sections = new int[sectionIndices.size()];
	for (int i = 0; i < sectionIndices.size(); i++) {
		sections[i] = sectionIndices.get(i);
	}
	return sections;
}
 
開發者ID:tony-Shx,項目名稱:Swface,代碼行數:32,代碼來源:StickyListAdapter.java

示例3: feature

import java.util.Date; //導入方法依賴的package包/類
@Override
@SuppressWarnings("deprecation")
public double[] feature(Date date) {
    double[] x = new double[types.length];
    for (int i = 0; i < types.length; i++)
    switch (types[i]) {
        case YEAR:
            x[i] = 1900 + date.getYear();
            break;
        case MONTH:
            x[i] = date.getMonth();
            break;
        case DAY_OF_MONTH:
            x[i] = date.getDate();
            break;
        case DAY_OF_WEEK:
            x[i] = date.getDay();
            break;
        case HOURS:
            x[i] = date.getHours();
            break;
        case MINUTES:
            x[i] = date.getMinutes();
            break;
        case SECONDS:
            x[i] = date.getSeconds();
            break;
        default:
            throw new IllegalStateException("Unknown date feature type: " + types[i]);
    }
    return x;
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:33,代碼來源:DateFeature.java

示例4: getDateToday

import java.util.Date; //導入方法依賴的package包/類
public void getDateToday(){
    Date date = new Date();
    date.getTime();

    int a = date.getDay();
    System.out.println(a);
}
 
開發者ID:cyber-coders-j2017a,項目名稱:modern.core.java.repo,代碼行數:8,代碼來源:Travels.java

示例5: getLocalWeekDay

import java.util.Date; //導入方法依賴的package包/類
public static int getLocalWeekDay() {
    Calendar.getInstance().get(7);
    Date date = new Date(System.currentTimeMillis());
    if (date.getDay() == 0) {
        return 7;
    }
    return date.getDay();
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:9,代碼來源:StringUtils.java

示例6: getCurrentWeek

import java.util.Date; //導入方法依賴的package包/類
public static String getCurrentWeek()
{
    Date dt = getCurrentDate();
    if (dt != null)
    {
        int day = dt.getDay();
        
        switch (day)
        {
            case 0:
                
                return "星期日";
            case 1:
                
                return "星期一";
            case 2:
                
                return "星期二";
            case 3:
                
                return "星期三";
            case 4:
                
                return "星期四";
            case 5:
                
                return "星期五";
                
            case 6:
                
                return "星期六";
                
            default:
                break;
        }
    }
    return "";
}
 
開發者ID:zhuyu1022,項目名稱:amap,代碼行數:39,代碼來源:MIP_DateUtil.java

示例7: getShortTimeText

import java.util.Date; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public static String getShortTimeText(Long oldTime) {
	Date time = parseDate(oldTime, TimeFormat);
	Date now = new Date();
	String format = "yyyy-MM-dd HH:mm";
	if (time.getYear() == now.getYear()) {
		format = format.substring("yyyy-".length());
		if (time.getMonth() == now.getMonth() && time.getDay() == now.getDay()) {
			format = format.substring("MM-dd ".length());
		}
	}
	return formatDate(time, format);
}
 
開發者ID:DataAgg,項目名稱:DAFramework,代碼行數:14,代碼來源:TextUtils.java

示例8: weekNumber

import java.util.Date; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
static int weekNumber(int year, int month) {
	Date d = new Date(year - 1900, month - 1, 1);
	while (d.getDay() != CalendarUtil.getStartingDayOfWeek()) d.setDate(d.getDate() - 1);
	int y = d.getYear();
	int week = 0;
	while (d.getYear() == y) { d.setDate(d.getDate() - 7); week += 1; }
	return week;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:10,代碼來源:PeriodPreferencesWidget.java

示例9: getTimeState

import java.util.Date; //導入方法依賴的package包/類
public static boolean getTimeState(long time) {
    boolean output;

    Date last = new Date(time);
    Date current = new Date(System.currentTimeMillis());

    output = last.getYear() < current.getYear() ||
            last.getMonth() < current.getMonth() ||
            last.getDay() < current.getDay() ||
            last.getHours() < current.getHours() ||
            last.getMinutes() < current.getMinutes();

    return output;
}
 
開發者ID:pedromassango,項目名稱:Programmers,代碼行數:15,代碼來源:Util.java

示例10:

import java.util.Date; //導入方法依賴的package包/類
public static Integer 星期(Date $時間) {
		return $時間.getDay();
}
 
開發者ID:MikaGuraN,項目名稱:HL4A,代碼行數:4,代碼來源:時間工具.java

示例11: IsToday

import java.util.Date; //導入方法依賴的package包/類
public boolean IsToday() {
    Calendar calendar = Calendar.getInstance();
    Date now = calendar.getTime();
    return _begin.getDay() == now.getDay() && _begin.getMonth() == now.getMonth() && _begin.getYear() == now.getYear();
}
 
開發者ID:GuepardoApps,項目名稱:LucaHome-AndroidApplication,代碼行數:6,代碼來源:CalendarEntryDto.java

示例12: getTodaysDate

import java.util.Date; //導入方法依賴的package包/類
public void getTodaysDate(){
    Date date = new Date();
    date.getTime();


    int today = date.getDay();
    System.out.println(today);

}
 
開發者ID:cyber-coders-j2017a,項目名稱:modern.core.java.repo,代碼行數:10,代碼來源:GetDate.java


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