本文整理汇总了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 "星期一";
}
}
示例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;
}
示例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;
}
示例4: getDateToday
import java.util.Date; //导入方法依赖的package包/类
public void getDateToday(){
Date date = new Date();
date.getTime();
int a = date.getDay();
System.out.println(a);
}
示例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();
}
示例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 "";
}
示例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);
}
示例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;
}
示例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;
}
示例10:
import java.util.Date; //导入方法依赖的package包/类
public static Integer 星期(Date $时间) {
return $时间.getDay();
}
示例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();
}
示例12: getTodaysDate
import java.util.Date; //导入方法依赖的package包/类
public void getTodaysDate(){
Date date = new Date();
date.getTime();
int today = date.getDay();
System.out.println(today);
}