当前位置: 首页>>代码示例>>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;未经允许,请勿转载。