setMinutes ( )源码实例Demo

java.util.Date#setMinutes ( )源码实例Demo

下面列出了java.util.Date#setMinutes ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = context.getLayoutInflater();
    View listViewItem = inflater.inflate(R.layout.layout_appointment_list, null, true);

    TextView textViewName = (TextView) listViewItem.findViewById(R.id.clinicName);
    TextView textViewDate = (TextView) listViewItem.findViewById(R.id.dateTime);
    TextView textViewService = (TextView) listViewItem.findViewById(R.id.clinicService);

    Booking booking = bookings.get(position);
    textViewName.setText(booking.getClinic().getName());
    String pattern = "yyyy-MM-dd HH:mm ";
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
    Date showDate = new Date();
    showDate.setHours(booking.getTime().getHours());
    showDate.setMinutes(booking.getTime().getMinutes());
    showDate.setDate(booking.getTime().getDate());
    showDate.setMonth(booking.getTime().getMonth());
    showDate.setYear(booking.getTime().getYear());

    String date = simpleDateFormat.format(showDate);
    textViewDate.setText(date);
    textViewService.setText(booking.getService().getName());
    return listViewItem;
}
 
源代码2 项目: JavaRush   文件: Solution.java
@SuppressWarnings("deprecation")
private static boolean isDateOdd(String date) {
  boolean bool;
  Date date1 = new Date(date);
  Date ms = new Date(date);
  ms.setHours(0);
  ms.setMinutes(0);
  ms.setSeconds(0);
  ms.setMonth(0);
  ms.setDate(1);
  long num = date1.getTime() - ms.getTime();
  long dayMs = 24 * 60 * 60 * 1000;
  int day = (int) (num / dayMs);
  bool = day % 2 == 0;
  return bool;
}
 
源代码3 项目: TimeSelector   文件: PowerDateUtils.java
/**
 * 向前10分钟
 * 
 * @param date
 * @return
 */
public static String getNowGisDateForwardString(String date) {
	SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
	String str = null;
	try {
		Date curDate = new Date(
				formatter.parse(date).getTime() + 10 * 60 * 1000);
		curDate.setMinutes(curDate.getMinutes() / 10 * 10);
		str = formatter.format(curDate);
		Log.i("time", "getNowGisDateForwardString" + str);
	} catch (ParseException e) {
		e.printStackTrace();
	}
	return str;

}
 
源代码4 项目: TimeSelector   文件: PowerDateUtils.java
/**
 * 向后10分钟
 * 
 * @param date
 * @return
 */
public static String getNowGisDateBackwardsString(String date) {
	SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
	String str = null;
	try {
		Date curDate = new Date(
				formatter.parse(date).getTime() - 10 * 60 * 1000);
		curDate.setMinutes(curDate.getMinutes() / 10 * 10);
		str = formatter.format(curDate);
		Log.i("time", "getNowGisDateBackwardsString" + str);
	} catch (ParseException e) {
		e.printStackTrace();
	}
	return str;

}
 
源代码5 项目: Android-Allocine-Api   文件: Horaires.java
public boolean isMoreThanToday() {
        try {
            String dateFormatted = getDate();

            Date now = new Date();
            now.setHours(0);
            now.setSeconds(0);
            now.setMinutes(0);

            SimpleDateFormat formater = new SimpleDateFormat("E dd MMMMM yyyy", Locale.FRANCE);
            Date date = formater.parse(dateFormatted);

            date.setHours(13);

            return date.equals(now) || date.after(now);
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
}
 
@Test
public void givenDate_whenHasOffset_thenConvertWithOffset() {
    TimeZone prevTimezone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("UTC"));

    Date date = new Date();
    date.setHours(6);
    date.setMinutes(30);

    OffsetDateTime odt = ConvertToOffsetDateTime.convert(date, 3, 30);
    assertEquals(10, odt.getHour());
    assertEquals(0, odt.getMinute());

    // Reset the timezone to its original value to prevent side effects
    TimeZone.setDefault(prevTimezone);
}
 
源代码7 项目: flink-learning   文件: DateUtilTests.java
@Test
public void testWithTimeAtEndOfNow() {
    Date date = new Date();
    date.setHours(23);
    date.setMinutes(59);
    date.setSeconds(59);
    String data = new SimpleDateFormat("yyyyMMddHHmmss").format(date);
    Assert.assertEquals(data, DateUtil.withTimeAtEndOfNow());
}
 
源代码8 项目: datacollector   文件: TimeNowEL.java
@ElFunction(prefix = TIME_CONTEXT_VAR, name = "trimTime", description = "Set time portion of datetime expression to 00:00:00")
@SuppressWarnings("deprecation")
public static Date trimTime(@ElParam("datetime") Date in) {
  if(in == null) {
    return null;
  }

  Date ret = new Date(in.getTime());
  ret.setHours(0);
  ret.setMinutes(0);
  ret.setSeconds(0);
  return ret;
}
 
源代码9 项目: flink-learning   文件: DateUtilTests.java
@Test
public void testWithTimeAtStartOfNow() {
    Date date = new Date();
    date.setHours(0);
    date.setMinutes(0);
    date.setSeconds(0);
    String data = new SimpleDateFormat("yyyyMMddHHmmss").format(date);
    Assert.assertEquals(data, DateUtil.withTimeAtStartOfNow());
}
 
源代码10 项目: flink-learning   文件: DateUtilTests.java
@Test
public void testWithTimeAtEndOfNow() {
    Date date = new Date();
    date.setHours(23);
    date.setMinutes(59);
    date.setSeconds(59);
    String data = new SimpleDateFormat("yyyyMMddHHmmss").format(date);
    Assert.assertEquals(data, DateUtil.withTimeAtEndOfNow());
}
 
源代码11 项目: TimeSelector   文件: PowerDateUtils.java
public static String getNowGisDateString() {
	SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
	Date curDate = new Date(System.currentTimeMillis() - 20 * 60 * 1000);// 获取当前时间
	curDate.setMinutes(curDate.getMinutes() / 10 * 10);
	String str = formatter.format(curDate);
	Log.i("time", "getNowGisDateString" + str);
	return str;

}
 
源代码12 项目: SensorWebClient   文件: DataControlsTimeSeries.java
private Date createDate(Date date, String time) {
    if (time.length() == 5) {
        date.setHours(new Integer(time.substring(0, 2)));
        date.setMinutes(new Integer(time.substring(3, 5)));
    } else if (time.length() == 4) {
        date.setHours(new Integer(time.substring(0, 1)));
        date.setMinutes(new Integer(time.substring(2, 4)));
    }
    return date;
}
 
源代码13 项目: Albianj2   文件: AlbianDateTime.java
@SuppressWarnings("deprecation")
public static Date dateAddSeconds(int year, int month, int day, long second) {
    Date dt = new Date();
    dt.setYear(year - 1900);
    dt.setMonth(month - 1);
    dt.setDate(day);
    dt.setHours(0);
    dt.setMinutes(0);
    dt.setSeconds(0);
    Calendar rightNow = Calendar.getInstance();
    rightNow.setTime(dt);
    rightNow.add(Calendar.SECOND, (int) second);
    Date dt1 = rightNow.getTime();
    return dt1;
}
 
源代码14 项目: SimpleDialogFragments   文件: DateTimeViewHolder.java
@Override
protected void putResults(Bundle results, String key) {
    Date res = new Date(day == null ? 0 : day);
    res.setHours(hour == null ? 0 : hour);
    res.setMinutes(minute == null ? 0 : minute);
    results.putLong(key, res.getTime());
}
 
源代码15 项目: j2objc   文件: DateTest.java
/**
 * java.util.Date#setMinutes(int)
 */
public void test_setMinutesI() {
    // Test for method void java.util.Date.setMinutes(int)
    Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
            .getTime();
    d.setMinutes(45);
    assertEquals("Set incorrect mins", 45, d.getMinutes());
}
 
源代码16 项目: unitime   文件: ScriptPage.java
@Override
@SuppressWarnings("deprecation")
public String getText() {
	Date date = iDate.getValue();
	if (date == null) return null;
	Integer slot = iTime.getValue();
	if (slot != null) {
		int h = (slot * 5) / 60;
		int m = (slot * 5) % 60;
		date.setHours(h); date.setMinutes(m);
	}
	return iFormat.format(date);
}
 
@Override
public CreateOrderCondition getConditon() {
	CreateOrderCondition condition = new CreateOrderCondition();
		Date date = new Date();
		date = util.Tool.addDate(date, 1);
		Date date2 = util.Tool.addDate(date, 1);
		Date date3 = util.Tool.addDate(date, 0);
		date3.setHours(15);
		date3.setMinutes(0);
		date3.setSeconds(0);
		Date date4 = util.Tool.addDate(date, 0);
		date4.setHours(17);
		date4.setMinutes(0);
		date4.setSeconds(0);
		
		condition.setHotelId("10101129");
		condition.setRoomTypeId("0010");
		condition.setRatePlanId(145742);
		condition.setTotalPrice(new BigDecimal(600));
		condition.setAffiliateConfirmationId("my-order-id-2");
		
		condition.setArrivalDate(date);
		condition.setConfirmationType(elong.EnumConfirmationType.NotAllowedConfirm);
		condition.setContact(getContact());
		condition.setCreditCard(getCreditCard());
		condition.setCurrencyCode(elong.EnumCurrencyCode.HKD);
		condition.setCustomerIPAddress("211.151.230.21");
		condition.setCustomerType(elong.EnumGuestTypeCode.OtherForeign);
		condition.setDepartureDate(date2);
		condition.setEarliestArrivalTime(date3);
		condition.setExtendInfo(null);			
		condition.setInvoice(null);
		condition.setIsForceGuarantee(false);
		condition.setIsGuaranteeOrCharged(false);
		condition.setIsNeedInvoice(false);
		condition.setLatestArrivalTime(date4);
		condition.setNightlyRates(null);
		condition.setNoteToElong("");
		condition.setNoteToHotel(null);
		condition.setNumberOfCustomers(1);
		condition.setNumberOfRooms(1);
		condition.setOrderRooms( getRooms() );
		condition.setPaymentType(elong.EnumPaymentType.SelfPay);
		condition.setSupplierCardNo(null);
		
		
	
	return condition;
}
 
protected Date nextIntervalDate(Date intervalMinDate, DateIntervalType intervalType, int intervals) {
    Date intervalMaxDate = new Date(intervalMinDate.getTime());

    if (MILLENIUM.equals(intervalType)) {
        intervalMaxDate.setYear(intervalMinDate.getYear() + 1000 * intervals);
    }
    else if (CENTURY.equals(intervalType)) {
        intervalMaxDate.setYear(intervalMinDate.getYear() + 100 * intervals);
    }
    else if (DECADE.equals(intervalType)) {
        intervalMaxDate.setYear(intervalMinDate.getYear() + 10 * intervals);
    }
    else if (YEAR.equals(intervalType)) {
        intervalMaxDate.setYear(intervalMinDate.getYear() +  intervals);
    }
    else if (QUARTER.equals(intervalType)) {
        intervalMaxDate.setMonth(intervalMinDate.getMonth() + 3 * intervals);
    }
    else if (MONTH.equals(intervalType)) {
        intervalMaxDate.setMonth(intervalMinDate.getMonth() + intervals);
    }
    else if (WEEK.equals(intervalType)) {
        intervalMaxDate.setDate(intervalMinDate.getDate() + 7 * intervals);
    }
    else if (DAY.equals(intervalType) || DAY_OF_WEEK.equals(intervalType)) {
        intervalMaxDate.setDate(intervalMinDate.getDate() + intervals);
    }
    else if (HOUR.equals(intervalType)) {
        intervalMaxDate.setHours(intervalMinDate.getHours() + intervals);
    }
    else if (MINUTE.equals(intervalType)) {
        intervalMaxDate.setMinutes(intervalMinDate.getMinutes() + intervals);
    }
    else if (SECOND.equals(intervalType)) {
        intervalMaxDate.setSeconds(intervalMinDate.getSeconds() + intervals);
    }
    else {
        // Default to year to avoid infinite loops
        intervalMaxDate.setYear(intervalMinDate.getYear() + intervals);
    }
    return intervalMaxDate;
}
 
源代码19 项目: MOOC   文件: AdminController.java
@RequestMapping(value="banip")//封禁ip
public void banip(HttpServletResponse resp,HttpSession session,String ip,String mark,String time) throws IOException{
	Date date = new Date();
	Ipset ip1 = ipsetBiz.selectip(ip);
	boolean isnull = false;
	if(ip1==null) {
		ip1=new Ipset();
		ip1.setIp(ip);
		isnull =true;
	}
	ip1.setIp(ip);
	ip1.setMark(mark);
	ip1.setType("1");
	if(time.equals("5m")) {
		if(date.getMinutes()>55) {
			date.setMinutes(date.getMinutes()-55);
			date.setHours(date.getHours()+1);
		}else {
		date.setMinutes(date.getMinutes()+5);
		}
		ip1.setBantime(date);
	}else if(time.equals("2h")) {
		date.setHours(date.getHours()+2);
		ip1.setBantime(date);
	}else if(time.equals("1d")) {
		date.setDate(date.getDate()+1);
		ip1.setBantime(date);
	}else if(time.equals("1m")) {
		date.setMonth(date.getMonth()+1);
		ip1.setBantime(date);
	}else if(time.equals("1y")) {
		date.setYear(date.getYear()+1);
		ip1.setBantime(date);
	}else if(time.equals("ever")) {
		date.setYear(date.getYear()+99);
		ip1.setBantime(date);
	}
	if(isnull) {
		ipsetBiz.insert(ip1);
	}else {
	ipsetBiz.updateByPrimaryKeySelective(ip1);
	}
	resp.setCharacterEncoding("utf-8");
	resp.getWriter().write("封禁成功!封禁至:"+date);
}
 
@Override
public void handleMessage(byte[] data) {
    if (data.length < 15){
        failed = true;
        return;
    }
    DanaRPump pump = DanaRPump.getInstance();

    int dataIndex = DATA_START;
    int dataSize = 2;
    pump.iob = byteArrayToInt(getBytes(data, dataIndex, dataSize));

    dataIndex += dataSize;
    dataSize = 2;
    pump.dailyTotalUnits = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;

    dataIndex += dataSize;
    dataSize = 1;
    pump.isExtendedInProgress = byteArrayToInt(getBytes(data, dataIndex, dataSize)) == 0x01;

    dataIndex += dataSize;
    dataSize = 2;
    pump.extendedBolusRemainingMinutes = byteArrayToInt(getBytes(data, dataIndex, dataSize));

    dataIndex += dataSize;
    dataSize = 2;
    double remainRate = byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d;

    Date lastBolusTime = new Date(); // it doesn't provide day only hour+min, workaround: expecting today
    dataIndex += dataSize;
    dataSize = 1;
    lastBolusTime.setHours(byteArrayToInt(getBytes(data, dataIndex, dataSize)));

    dataIndex += dataSize;
    dataSize = 1;
    lastBolusTime.setMinutes(byteArrayToInt(getBytes(data, dataIndex, dataSize)));

    dataIndex += dataSize;
    dataSize = 2;
    pump.lastBolusAmount = byteArrayToInt(getBytes(data, dataIndex, dataSize));
    // On DanaRS DailyUnits can't be more than 160
    if(pump.dailyTotalUnits > 160)
        failed = true;
    if (L.isEnabled(L.PUMPCOMM)) {
        log.debug("Daily total units: " + pump.dailyTotalUnits + " U");
        log.debug("Is extended in progress: " + pump.isExtendedInProgress);
        log.debug("Extended bolus remaining minutes: " + pump.extendedBolusRemainingMinutes);
        log.debug("Last bolus time: " + lastBolusTime.toLocaleString());
        log.debug("Last bolus amount: " + pump.lastBolusAmount);
    }
}