本文整理匯總了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);
}