当前位置: 首页>>代码示例>>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;未经允许,请勿转载。