org.joda.time.DateTime.getMinuteOfHour()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(203)

本文整理了Java中org.joda.time.DateTime.getMinuteOfHour()方法的一些代码示例,展示了DateTime.getMinuteOfHour()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTime.getMinuteOfHour()方法的具体详情如下:
包路径:org.joda.time.DateTime
类名称:DateTime
方法名:getMinuteOfHour

DateTime.getMinuteOfHour介绍

暂无

代码示例

代码示例来源:origin: Graylog2/graylog2-server

private static Map<String, Object> ingestTimeFields(DateTime ingestTime) {
  return ImmutableMap.<String, Object>builder()
      .put("ingest_time", ingestTime.toString())
      .put("ingest_time_epoch", ingestTime.getMillis())
      .put("ingest_time_second", ingestTime.getSecondOfMinute())
      .put("ingest_time_minute", ingestTime.getMinuteOfHour())
      .put("ingest_time_hour", ingestTime.getHourOfDay())
      .put("ingest_time_day", ingestTime.getDayOfMonth())
      .put("ingest_time_month", ingestTime.getMonthOfYear())
      .put("ingest_time_year", ingestTime.getYear())
      .build();
}

代码示例来源:origin: alibaba/canal

dateTime = new DateTime(((Date) val).getTime());
if (dateTime.getHourOfDay() == 0 && dateTime.getMinuteOfHour() == 0 && dateTime.getSecondOfMinute() == 0
  && dateTime.getMillisOfSecond() == 0) {
  res = dateTime.toString("yyyy-MM-dd");
if (dateTime.getHourOfDay() == 0 && dateTime.getMinuteOfHour() == 0 && dateTime.getSecondOfMinute() == 0
  && dateTime.getMillisOfSecond() == 0) {
  res = dateTime.toString("yyyy-MM-dd");

代码示例来源:origin: prestodb/presto

@Test
public void testTimeZone()
{
  assertFunction("hour(" + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getHourOfDay());
  assertFunction("minute(" + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getMinuteOfHour());
  assertFunction("hour(" + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getHourOfDay());
  assertFunction("minute(" + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getMinuteOfHour());
  assertFunction("current_timezone()", VARCHAR, TIME_ZONE_KEY.getId());
}

代码示例来源:origin: apache/drill

@Test
public void testDateTimeHoursMinutesSecondsFormat() {
 String day = "24";
 String month = "June";
 int year = 2010;
 int hours = 10;
 int minutes = 12;
 DateTime date = parseDateFromPostgres(year + "" + day + month + hours + ":" + minutes + "am", "YYYYDDFMMonthHH12:MIam");
 Assert.assertTrue(date.getDayOfMonth() == Integer.parseInt(day) &&
           date.getMonthOfYear() == 6 &&
           date.getYear() == year &&
           date.getHourOfDay() == hours &&
           date.getMinuteOfHour() == minutes);
}

代码示例来源:origin: apache/incubator-pinot

case MINUTES:
 _dateTimeTruncate = (dateTime) -> _outputDateTimeFormatter
   .print(dateTime.withMinuteOfHour((dateTime.getMinuteOfHour() / sz) * sz).minuteOfHour().roundFloorCopy());
 break;
case HOURS:

代码示例来源:origin: apache/drill

@Test
public void testTimeHoursMinutesSecondsFormat() {
 int hours = 11;
 int minutes = 50;
 String seconds = "05";
 DateTime date = parseDateFromPostgres(hours + ":" + minutes + ":" + seconds + " am", "hh12:mi:ss am");
 Assert.assertTrue(date.getHourOfDay() == hours &&
           date.getMinuteOfHour() == minutes &&
            date.getSecondOfMinute() == Integer.parseInt(seconds));
}

代码示例来源:origin: apache/drill

@Test
public void testTimeHours24MinutesSecondsFormat() {
 int hours = 15;
 int minutes = 50;
 int seconds = 5;
 DateTime date = parseDateFromPostgres(hours + ":" + minutes + ":" + seconds, "hh24:mi:ss");
 Assert.assertTrue(date.getHourOfDay() == hours &&
           date.getMinuteOfHour() == minutes &&
           date.getSecondOfMinute() == seconds);
}

代码示例来源:origin: prestodb/presto

assertFunction("extract(minute FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getMinuteOfHour());
assertFunction("extract(hour FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getHourOfDay());
assertFunction("extract(day_of_week FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getDayOfWeek());
assertFunction("extract(minute FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getMinuteOfHour());
assertFunction("extract(hour FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getHourOfDay());
assertFunction("extract(day_of_week FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getDayOfWeek());

代码示例来源:origin: stackoverflow.com

// with JodaTime 2.4
final DateTime dt = new DateTime(timestamp);
// here's how to get the minutes
final int minutes2 = dt.getMinuteOfHour();
// and here's how to get the String representation
final String timeString2 = dt.toString("HH:mm:ss:SSS");
System.out.println(minutes2);
System.out.println(timeString2);

代码示例来源:origin: stackoverflow.com

DateTime dt = new DateTime(1385577373517L, DateTimeZone.UTC);
// Prints 2013-11-27T18:36:13.517Z
System.out.println(dt);

// Prints 2013-11-27T18:36:00.000Z (Floor rounded to a minute)
System.out.println(dt.minuteOfDay().roundFloorCopy());

// Prints 2013-11-27T18:30:00.000Z (Rounded to custom minute Window)
int windowMinutes = 10;
System.out.println(
  dt.withMinuteOfHour((dt.getMinuteOfHour() / windowMinutes) * windowMinutes)
    .minuteOfDay().roundFloorCopy()
  );

代码示例来源:origin: stackoverflow.com

DatePicker datePicker = (DatePicker) findViewById(R.id.inspected_at_date);
TimePicker timePicker = (TimePicker) findViewById(R.id.inspected_at_time);

DateTime inspected_at = DateTime.now()                // Typically pulled from DB.

int year    = inspected_at.getYear() ;
int month   = inspected_at.getMonthOfYear() - 1;      // Need to subtract 1 here.
int day     = inspected_at.getDayOfMonth();  
int hour    = inspected_at.getHourOfDay();
int minutes = inspected_at.getMinuteOfHour();

datePicker.updateDate(year, month, day);              // Set date.

timePicker.setCurrentHour(hour);                      // Set time.
timePicker.setCurrentMinute(minutes);

代码示例来源:origin: HubSpot/Singularity

public Date getNextValidTime() {
 final long now = System.currentTimeMillis();
 DateTime startDateTime = new DateTime(dtStart.getYear(), (dtStart.getMonthOfYear() - 1), dtStart.getDayOfMonth(),
  dtStart.getHourOfDay(), dtStart.getMinuteOfHour(), dtStart.getSecondOfMinute());
 RecurrenceRuleIterator timeIterator = recurrenceRule.iterator(startDateTime);
 int count = 0;
 while (timeIterator.hasNext() && (count < MAX_ITERATIONS || (recurrenceRule.hasPart(Part.COUNT) && count < recurrenceRule.getCount()))) {
  count ++;
  long nextRunAtTimestamp = timeIterator.nextMillis();
  if (nextRunAtTimestamp >= now) {
   return new Date(nextRunAtTimestamp);
  }
 }
 return null;
}

代码示例来源:origin: org.elasticsearch/elasticsearch

bucket.saveField(DateTimeFieldType.dayOfMonth(), dt.getDayOfMonth());
bucket.saveField(DateTimeFieldType.hourOfDay(), dt.getHourOfDay());
bucket.saveField(DateTimeFieldType.minuteOfHour(), dt.getMinuteOfHour());
bucket.saveField(DateTimeFieldType.secondOfMinute(), dt.getSecondOfMinute());
bucket.saveField(DateTimeFieldType.millisOfSecond(), dt.getMillisOfSecond());

代码示例来源:origin: org.jruby/jruby-complete

/**
 * @return minute-of-hour
 * @since 9.2
 */
public int getMinute() { return dt.getMinuteOfHour(); }

代码示例来源:origin: stackoverflow.com

DateTimeFormatter jodaFormatter = ISODateTimeFormat.dateTime();
DateTime jodaParsed = jodaFormatter
        .parseDateTime("2013-05-17T16:27:34.9+05:30");
Date date2 = jodaParsed.toDate();
System.out.println("Date & Day:" + jodaParsed.getDayOfMonth() + "-" + jodaParsed.getMonthOfYear() + "-" + jodaParsed.getYear() + " " + jodaParsed.getHourOfDay() + ":" + jodaParsed.getMinuteOfHour()+" "+jodaParsed.dayOfWeek().getAsText());

代码示例来源:origin: metatron-app/metatron-discovery

private List<DateTime> getSecondLabels(DateTime min, DateTime max, int unitSize) {
 List<DateTime> labels = new ArrayList<>();
 DateTime dt = new DateTime(min.getYear(), min.getMonthOfYear(), min.getDayOfMonth(),
     min.getHourOfDay(), min.getMinuteOfHour(), min.getSecondOfMinute() / unitSize * unitSize);
 while (dt.isBefore(max) || dt.isEqual(max)) {
  labels.add(dt);
  dt = dt.plusSeconds(unitSize);
 }
 labels.add(dt);
 return labels;
}

代码示例来源:origin: metatron-app/metatron-discovery

private List<DateTime> getMillisLabels(DateTime min, DateTime max, int unitSize) {
 List<DateTime> labels = new ArrayList<>();
 DateTime dt = new DateTime(min.getYear(), min.getMonthOfYear(), min.getDayOfMonth(),
     min.getHourOfDay(), min.getMinuteOfHour(), min.getSecondOfMinute(), min.getMillisOfSecond() / unitSize * unitSize);
 while (dt.isBefore(max) || dt.isEqual(max)) {
  labels.add(dt);
  dt = dt.plusMillis(unitSize);
 }
 labels.add(dt);
 return labels;
}

代码示例来源:origin: org.jasig.portlet/blackboardvc-portlet-api

public void setEndTime(DateTime endTime) {
  endDate = endTime.toDateMidnight();
  endHour = endTime.getHourOfDay();
  endMinute = endTime.getMinuteOfHour();
  endHourMinute = new LocalTime(endTime);
}

代码示例来源:origin: org.jruby/jruby-core

private static RubyDateTime calcAjdFromCivil(ThreadContext context, final DateTime dt, final int off,
                       final long subMillisNum, final long subMillisDen) {
  final Ruby runtime = context.runtime;
  long jd = civil_to_jd(dt.getYear(), dt.getMonthOfYear(), dt.getDayOfMonth(), ITALY);
  RubyNumeric fr = timeToDayFraction(context, dt.getHourOfDay(), dt.getMinuteOfHour(), dt.getSecondOfMinute());
  final RubyNumeric ajd = jd_to_ajd(context, jd, fr, off);
  RubyDateTime dateTime = new RubyDateTime(context, getDateTime(runtime), ajd, off, ITALY);
  dateTime.dt = dateTime.dt.withMillisOfSecond(dt.getMillisOfSecond());
  dateTime.subMillisNum = subMillisNum; dateTime.subMillisDen = subMillisDen;
  return dateTime;
}

代码示例来源:origin: io.prestosql/presto-main

@Test
public void testTimeZone()
{
  assertFunction("hour(" + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getHourOfDay());
  assertFunction("minute(" + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getMinuteOfHour());
  assertFunction("hour(" + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getHourOfDay());
  assertFunction("minute(" + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getMinuteOfHour());
  assertFunction("current_timezone()", VARCHAR, TIME_ZONE_KEY.getId());
}

相关文章

DateTime类方法