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


Java Date.setDate方法代碼示例

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


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

示例1: onBindViewHolder

import java.util.Date; //導入方法依賴的package包/類
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    Weather weather = weatherList.get(position);
    String[] time = weather.dayName.split(" ");
    String[] weatherTime = time[1].split(":");
    String[] date = time[0].split("-");
    SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
    Date d = new Date();
    d.setYear(Integer.parseInt(date[0]));
    d.setMonth(Integer.parseInt(date[1]) - 1);
    d.setDate(Integer.parseInt(date[2]) - 1);
    String dayOfTheWeek = sdf.format(d);
    Log.d("DAY", weather.dayName + " : " + dayOfTheWeek);
    holder.dayName.setText(NumbersLocal.convertNumberType(context, weatherTime[0] + ":" + weatherTime[1] + ""));
    holder.weather.setText(NumbersLocal.convertNumberType(context, weather.tempMini + "°"));
    holder.image.setImageResource(WeatherIcon.get_icon_id_white(weather.image));
}
 
開發者ID:fekracomputers,項目名稱:MuslimMateAndroid,代碼行數:18,代碼來源:WeatherAdapter.java

示例2: showDate

import java.util.Date; //導入方法依賴的package包/類
/**
 * Function to show saved weather
 *
 * @param weathers Saved weathers
 * @param position Position
 * @param temp     Temp text view
 * @param image    Weather view
 * @param day      Day of week text view
 */
public void showDate(List<mindtrack.muslimorganizer.model.Weather> weathers, int position
        , TextView temp, ImageView image, TextView day) {
    try {
        mindtrack.muslimorganizer.model.Weather weather = weathers.get(position);
        String[] time = weather.dayName.split(" ");
        String[] date = time[0].split("-");
        SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
        Date d = new Date();
        d.setYear(Integer.parseInt(date[0]));
        d.setMonth(Integer.parseInt(date[1]) - 1);
        d.setDate(Integer.parseInt(date[2]) - 1);
        String dayOfTheWeek = sdf.format(d);
        day.setText(dayOfTheWeek);
        image.setImageResource(WeatherIcon.get_icon_id_white(weather.image));
        temp.setText(NumbersLocal.convertNumberType(getContext(), "°" + weather.tempMax + " | " + weather.tempMini + "°"));
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:fekracomputers,項目名稱:MuslimMateAndroid,代碼行數:29,代碼來源:WeatherFragment.java

示例3: generateRandomDateTime

import java.util.Date; //導入方法依賴的package包/類
public Date generateRandomDateTime(){
    Date date = new Date();
    int year = randBetween(year_min-1900, year_max-1900);
    int month = randBetween(month_min, month_max);
    int day = randBetween(day_min, day_max);
    int hour = randBetween(hour_min, hour_max);
    int minute = randBetween(minute_min, minute_max);
    int second = randBetween(second_min, second_max);
    
    date.setYear(year);
    date.setMonth(month);
    date.setDate(day);
    date.setHours(hour);
    date.setMinutes(minute);
    date.setSeconds(second);
   
    return date;
}
 
開發者ID:faclc4,項目名稱:HTAPBench,代碼行數:19,代碼來源:RandomParameters.java

示例4: Date

import java.util.Date; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@ActionLayout(named = "Dias restantes para el cumpleaños", cssClassFa = "fa-birthday-cake")
public long calcularDiasRestantesParaCumpleaños() {
	Calendar hoyCal = Calendar.getInstance();
	Date hoyDate = hoyCal.getTime();
	Date cumpleaños = new Date();
	long cant;
	cumpleaños.setDate(this.getClienteFechaNacimiento().getDate());
	cumpleaños.setMonth(this.getClienteFechaNacimiento().getMonth());
	cumpleaños.setYear(hoyDate.getYear());
	if (cumpleaños.before(hoyDate)) {
		cumpleaños.setYear(cumpleaños.getYear() + 1);
	}
	cant = getDifferenceDays(hoyDate, cumpleaños);
	return cant;
}
 
開發者ID:leandrogonqn,項目名稱:Proyecto2017Seguros,代碼行數:17,代碼來源:Cliente.java

示例5: ok_actionPerformed

import java.util.Date; //導入方法依賴的package包/類
private void ok_actionPerformed(ActionEvent e) {
	Date d = (Date)date.getValue();
	Date start = (Date)timeStart.getValue();
	Date stop = (Date)timeStop.getValue();
	start.setYear(d.getYear());
	start.setMonth(d.getMonth());
	start.setDate(d.getDate());
	stop.setYear(d.getYear());
	stop.setMonth(d.getMonth());
	stop.setDate(d.getDate());
	timeStart.setValue(start);
	timeStop.setValue(stop);
	this.dispose();
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:15,代碼來源:TimeLogDialog.java

示例6: getLastDayOfMonth

import java.util.Date; //導入方法依賴的package包/類
/**
 * 月的最後一天
 * 
 * @param date
 * @return
 */
@SuppressWarnings("deprecation")
public static Date getLastDayOfMonth(Date date) {
	Calendar cDay1 = Calendar.getInstance();
	cDay1.setTime(date);
	int lastDay = cDay1.getActualMaximum(Calendar.DAY_OF_MONTH);
	Date lastDate = cDay1.getTime();
	lastDate.setDate(lastDay);
	return lastDate;
}
 
開發者ID:xubinux,項目名稱:xbin-store,代碼行數:16,代碼來源:DateUtils.java

示例7: isDateOdd

import java.util.Date; //導入方法依賴的package包/類
public static boolean isDateOdd(String date) {
        Date dt1 = new Date(date);
        Date dt2 = new Date(date);
        dt1.setMonth(0);
        dt1.setDate(1);

//        System.out.println(dt1.getTime());
//        System.out.println(dt2.getTime());
        long a = (dt2.getTime()-dt1.getTime())/(3600*24*1000)+1;
        if (a % 2 != 0)
            return true;
        //System.out.println(dt2.getTime()-dt1.getTime());
        //System.out.println (a);
        return false;
    }
 
開發者ID:avedensky,項目名稱:JavaRushTasks,代碼行數:16,代碼來源:Solution.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: dayOfYear

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

示例10: addDays

import java.util.Date; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public void addDays(int days) {
	Date d = getValue();
	if (d == null) {
		setDate(new Date());
	} else {
		d.setDate(d.getDate() + days);
		setDate(d);
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:11,代碼來源:SingleDateSelector.java

示例11: getNowRainStartDateString

import java.util.Date; //導入方法依賴的package包/類
public static String getNowRainStartDateString() {
	SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
	Date curDate = new Date(System.currentTimeMillis());
	curDate.setDate(curDate.getDate() - 1);
	return formatter.format(curDate);
}
 
開發者ID:yellowhai,項目名稱:TimeSelector,代碼行數:7,代碼來源:PowerDateUtils.java

示例12: getDate

import java.util.Date; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
protected static Date getDate(Date firstDate, int date) {
   	Date ret = new Date(firstDate.getTime());
   	ret.setDate(ret.getDate() + date);
   	return ret;
   }
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:7,代碼來源:TimetableGrid.java


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