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


Java LocalTime.getHourOfDay方法代碼示例

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


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

示例1: createDisposableTask

import org.joda.time.LocalTime; //導入方法依賴的package包/類
private TimedTask createDisposableTask() {
    LocalTime time = TIME_FORMATTER.parseLocalTime(mDisposableTaskTime.getText().toString());
    LocalDate date = DATE_FORMATTER.parseLocalDate(mDisposableTaskDate.getText().toString());
    LocalDateTime dateTime = new LocalDateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(),
            time.getHourOfDay(), time.getMinuteOfHour());
    if (dateTime.isBefore(LocalDateTime.now())) {
        Toast.makeText(this, R.string.text_disposable_task_time_before_now, Toast.LENGTH_SHORT).show();
        return null;
    }
    return TimedTask.disposableTask(dateTime, mScriptFile.getPath(), ExecutionConfig.getDefault());
}
 
開發者ID:hyb1996,項目名稱:Auto.js,代碼行數:12,代碼來源:TimedTaskSettingActivity.java

示例2: sumDeHours

import org.joda.time.LocalTime; //導入方法依賴的package包/類
@Test
public void sumDeHours()
{
    // Fixture Setup
    final LocalTime Hour1 = new LocalTime( 1, 12, 25 );
    final LocalTime Hour2 = new LocalTime( 2, 12, 25 );
    final LocalTime HourEsperada = new LocalTime( 3, 12, 25 );

    // Exercise SUT
    final int novaHour = Hour1.getHourOfDay() + Hour2.getHourOfDay();

    // Result Verification
    Assert.assertEquals( novaHour, HourEsperada.getHourOfDay() );

    // Fixture Teardown
}
 
開發者ID:evandrocoan,項目名稱:ComputerScienceGraduation,代碼行數:17,代碼來源:FirstClassJunitIndroduction.java

示例3: sumDeHoursFalha

import org.joda.time.LocalTime; //導入方法依賴的package包/類
@Test
public void sumDeHoursFalha()
{
    // Fixture Setup
    final LocalTime Hour1 = new LocalTime( 1, 12, 25 );
    final LocalTime Hour2 = new LocalTime( 2, 12, 25 );
    final LocalTime HourEsperada = new LocalTime( 2, 12, 25 );

    // Exercise SUT
    final int novaHour = Hour1.getHourOfDay() + Hour2.getHourOfDay();

    // Result Verification
    Assert.assertNotEquals( novaHour, HourEsperada.getHourOfDay() );

    // Fixture Teardown
}
 
開發者ID:evandrocoan,項目名稱:ComputerScienceGraduation,代碼行數:17,代碼來源:FirstClassJunitIndroduction.java

示例4: creationDeHours

import org.joda.time.LocalTime; //導入方法依賴的package包/類
@Test
public void creationDeHours()
{
    // Fixture Setup
    final LocalTime HourAtual = new LocalTime( 12, 12, 25 );
    final LocalTime HourEsperada = new LocalTime( 11, 12, 25 );

    // Exercise SUT
    final boolean isCorrectHour = HourAtual.getHourOfDay() > HourEsperada.getHourOfDay();

    // Result Verification
    Assert.assertTrue( isCorrectHour );

    // Fixture Teardown
}
 
開發者ID:evandrocoan,項目名稱:ComputerScienceGraduation,代碼行數:16,代碼來源:FirstClassJunitIndroduction.java

示例5: addDateAndTime

import org.joda.time.LocalTime; //導入方法依賴的package包/類
public static DateTime addDateAndTime(LocalDate date, LocalTime time)
{
    return new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(),
            time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), DATE_TZ);
}
 
開發者ID:jseparovic,項目名稱:MQL4Java,代碼行數:6,代碼來源:DateUtil.java

示例6: changeNotificationPreferences

import org.joda.time.LocalTime; //導入方法依賴的package包/類
private void changeNotificationPreferences(int departureMinutes, int arrivalMinutes) {
  Boolean haveNotifications = false;
  Boolean hadNotifications = false;
  Bundle bundle = new Bundle();
  bundle.putString(BundleKeys.TRIP, tripId);
  bundle.putString(BundleKeys.TRIP_NAME, possibleTrip.getTripShortName());
  bundle.putString(BundleKeys.STOP_SOURCE, sourceId);
  bundle.putString(BundleKeys.STOP_DESTINATION, destinationId);
  bundle.putString(BundleKeys.STOP_SOURCE_NAME, possibleTrip.getFirstStopName());
  bundle.putLong(BundleKeys.STOP_SOURCE_TIME, possibleTrip.getDepartureTime().toDateTimeToday().getMillis());
  bundle.putString(BundleKeys.STOP_DESTINATION_NAME, possibleTrip.getLastStopName());
  bundle.putLong(BundleKeys.STOP_DESTINATION_TIME, possibleTrip.getArrivalTime().toDateTimeToday().getMillis());

  hadNotifications = notifications.getAlarmId(tripId, Notifications.ARRIVING) != -1 || notifications.getAlarmId(tripId, Notifications.DEPARTING) != -1;
  notifications.cancel(tripId, Notifications.ARRIVING);
  notifications.cancel(tripId, Notifications.DEPARTING);
  chooChooFab.setBackgroundTintList(ColorStateList.valueOf(ColorUtils.getThemeColor(this, R.attr.colorAccent)));

  if (arrivalMinutes > 0) {
    LocalTime arrivalTime = possibleTrip.getArrivalTime();
    LocalDateTime arrivingDateTime = new LocalDateTime(stopDateTime.getYear(), stopDateTime.getMonthOfYear(), stopDateTime.getDayOfMonth(), arrivalTime.getHourOfDay(), arrivalTime.getMinuteOfHour());

    bundle.putString(BundleKeys.STOP_METHOD, Notifications.ARRIVING);
    notifications.set(tripId, arrivingDateTime, arrivalMinutes, Notifications.ARRIVING, bundle);
    chooChooFab.setBackgroundTintList(ColorStateList.valueOf(ColorUtils.getThemeColor(this, R.attr.colorPrimary)));
    haveNotifications = true;
  }

  if (departureMinutes > 0) {
    LocalTime departingTime = possibleTrip.getDepartureTime();
    LocalDateTime departingDateTime = new LocalDateTime(stopDateTime.getYear(), stopDateTime.getMonthOfYear(), stopDateTime.getDayOfMonth(), departingTime.getHourOfDay(), departingTime.getMinuteOfHour());

    bundle.putString(BundleKeys.STOP_METHOD, Notifications.DEPARTING);
    notifications.set(tripId, departingDateTime, departureMinutes, Notifications.DEPARTING, bundle);
    chooChooFab.setBackgroundTintList(ColorStateList.valueOf(ColorUtils.getThemeColor(this, R.attr.colorPrimary)));
    haveNotifications = true;
  }

  if (haveNotifications) {
    Toast.makeText(this, getString(R.string.notifications_saved), Toast.LENGTH_SHORT).show();
  } else if (hadNotifications) {
    Toast.makeText(this, getString(R.string.notifications_removed), Toast.LENGTH_SHORT).show();
  }
}
 
開發者ID:eleith,項目名稱:calchoochoo,代碼行數:45,代碼來源:TripActivity.java


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