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

x33g5p2x  于2022-01-23 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(213)

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

LocalTime.getMillisOfSecond介绍

[英]Get the millis of second field value.
[中]

代码示例

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Returns a copy of this datetime with the specified time, retaining the date fields.
  3. * <p>
  4. * If the new time is invalid due to the time-zone, the time will be adjusted.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param time the local time
  9. * @return a copy of this datetime with a different time
  10. * @throws IllegalArgumentException if the time-of-day is invalid for the date
  11. * @throws NullPointerException if the time is null
  12. */
  13. public DateTime withTime(LocalTime time) {
  14. return withTime(
  15. time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
  16. }

代码示例来源:origin: JodaOrg/joda-time

  1. /**
  2. * Returns a copy of this datetime with the specified time, retaining the date fields.
  3. * <p>
  4. * If the new time is invalid due to the time-zone, the time will be adjusted.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param time the local time
  9. * @return a copy of this datetime with a different time
  10. * @throws IllegalArgumentException if the time-of-day is invalid for the date
  11. * @throws NullPointerException if the time is null
  12. */
  13. public DateTime withTime(LocalTime time) {
  14. return withTime(
  15. time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
  16. }

代码示例来源:origin: joda-time/joda-time

  1. getYear(), getMonthOfYear(), getDayOfMonth(),
  2. time.getHourOfDay(), time.getMinuteOfHour(),
  3. time.getSecondOfMinute(), time.getMillisOfSecond(), chrono);

代码示例来源:origin: JodaOrg/joda-time

  1. getYear(), getMonthOfYear(), getDayOfMonth(),
  2. time.getHourOfDay(), time.getMinuteOfHour(),
  3. time.getSecondOfMinute(), time.getMillisOfSecond(), chrono);

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

  1. int t = ((TimeExpression)valueArg).getTime();
  2. LocalTime lT = LocalTime.fromMillisOfDay(t);
  3. this.value = KeyValueBuilder.initFrom(new OTime(lT.getHourOfDay(), lT.getMinuteOfHour(), lT.getSecondOfMinute(), lT.getMillisOfSecond()));
  4. this.path = path;
  5. return true;

代码示例来源:origin: org.jadira.usertype/usertype.core

  1. @Override
  2. public String toNonNullValue(LocalTime value) {
  3. if (value.getMillisOfSecond() == 0) {
  4. if (value.getSecondOfMinute() == 0) {
  5. return Formatter.LOCAL_TIME_NOSECONDS_PRINTER.print(value);
  6. }
  7. return Formatter.LOCAL_TIME_NOMILLIS_PRINTER.print(value);
  8. } else {
  9. return value.toString();
  10. }
  11. }
  12. }

代码示例来源:origin: org.jadira.usertype/usertype.jodatime

  1. @Override
  2. public String toNonNullValue(LocalTime value) {
  3. if (value.getMillisOfSecond() == 0) {
  4. if (value.getMinuteOfHour() == 0) {
  5. return Formatter.LOCAL_TIME_NOSECONDS_FORMATTER.print(value);
  6. }
  7. return Formatter.LOCAL_TIME_FORMATTER.print(value);
  8. } else {
  9. return value.toString();
  10. }
  11. }
  12. }

代码示例来源:origin: bingoohuang/eql

  1. @Override public Object map(Object obj) {
  2. val t = (LocalTime) obj;
  3. return Time.valueOf(java.time.LocalTime.of(t.getHourOfDay(), t.getMinuteOfHour(), t.getSecondOfMinute(), t.getMillisOfSecond()));
  4. }
  5. }

代码示例来源:origin: zhicwu/cassandra-jdbc-driver

  1. @Override
  2. public Time parse(String value) {
  3. if (value == null || value.isEmpty() || value.equalsIgnoreCase("NULL"))
  4. return null;
  5. // enclosing single quotes required, even for long literals
  6. if (!ParseUtils.isQuoted(value))
  7. throw new InvalidTypeException("time values must be enclosed by single quotes");
  8. value = value.substring(1, value.length() - 1);
  9. if (ParseUtils.isLongLiteral(value)) {
  10. long nanosOfDay;
  11. try {
  12. nanosOfDay = Long.parseLong(value);
  13. } catch (NumberFormatException e) {
  14. throw new InvalidTypeException(String.format("Cannot parse time value from \"%s\"", value), e);
  15. }
  16. return new Time(LocalTime.fromMillisOfDay(nanosOfDay / 1000000L).getMillisOfSecond());
  17. }
  18. try {
  19. return new Time(LocalTime.parse(value).toDateTimeToday().getMillis());
  20. } catch (RuntimeException e) {
  21. throw new InvalidTypeException(String.format("Cannot parse time value from \"%s\"", value), e);
  22. }
  23. }

代码示例来源:origin: qcadoo/mes

  1. private DateTime convertToDateTime(final DateTime currentDate, final LocalTime time) {
  2. return new DateTime(currentDate).withTime(time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(),
  3. time.getMillisOfSecond());
  4. }

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

  1. Date datePart= ...; // The date parsed from the first user input
  2. String userTimeInput = ...; // The time of day from the user
  3. Locale userLocale = ...;
  4. DateTimeZone userTimeZone = ...;
  5. DateTime dateInUserTimeZone = new DateTime(datePart, userTimeZone);
  6. DateTimeFormatter formatter = DateTimeFormat.shortTime().withLocale(userLocale);
  7. LocalTime time = formatter.parseLocalTime(userTimeInput);
  8. Date newDate = dateInUserTimeZone.withTime(time.getHourOfDay(), time.getMinuteOfHour(),
  9. time.getSecondOfMinute(), time.getMillisOfSecond()).toDate();

代码示例来源:origin: org.jadira.usertype/usertype.core

  1. @Override
  2. public TimeOfDay fromNonNullValue(Time value) {
  3. DateTime dateTime = new DateTime(value.getTime());
  4. LocalTime localTime = dateTime.toLocalTime();
  5. final TimeOfDay timeOfDay = new TimeOfDay(localTime.getHourOfDay(), localTime.getMinuteOfHour(), localTime.getSecondOfMinute(), localTime.getMillisOfSecond(), localTime.getChronology());
  6. return timeOfDay;
  7. }

代码示例来源:origin: org.jadira.usertype/usertype.core

  1. @Override
  2. public Timestamp toNonNullValue(LocalTime value) {
  3. DateTime zonedValue = new LocalDateTime(
  4. 1970,1,1,value.getHourOfDay(), value.getMinuteOfHour(), value.getSecondOfMinute(), value.getMillisOfSecond(), value.getChronology()
  5. ).toDateTime();
  6. final Timestamp timestamp = new Timestamp(zonedValue.getMillis());
  7. return timestamp;
  8. }
  9. }

代码示例来源:origin: org.jadira.usertype/usertype.core

  1. @Override
  2. public Time toNonNullValue(LocalTime value) {
  3. DateTime zonedValue = new LocalDateTime(
  4. 1970,1,1,value.getHourOfDay(), value.getMinuteOfHour(), value.getSecondOfMinute(), value.getMillisOfSecond(), value.getChronology()
  5. ).toDateTime();
  6. final Time time = new Time(zonedValue.getMillis());
  7. return time;
  8. }
  9. }

代码示例来源:origin: org.jadira.usertype/usertype.jodatime

  1. @Override
  2. public TimeOfDay fromNonNullValue(Timestamp value) {
  3. final LocalTime localTime = Formatter.LOCAL_DATETIME_PARSER.parseDateTime(value.toString()).toLocalTime();
  4. final TimeOfDay timeOfDay = new TimeOfDay(localTime.getHourOfDay(), localTime.getMinuteOfHour(), localTime.getSecondOfMinute(), localTime.getMillisOfSecond(), localTime.getChronology());
  5. return timeOfDay;
  6. }

代码示例来源:origin: org.jadira.usertype/usertype.core

  1. @Override
  2. public TimeOfDay fromNonNullValue(Timestamp value) {
  3. DateTime dateTime = new DateTime(value.getTime());
  4. LocalTime localTime = dateTime.toLocalTime();
  5. final TimeOfDay timeOfDay = new TimeOfDay(localTime.getHourOfDay(), localTime.getMinuteOfHour(), localTime.getSecondOfMinute(), localTime.getMillisOfSecond(), localTime.getChronology());
  6. return timeOfDay;
  7. }

代码示例来源:origin: arnaudroger/SimpleFlatMapper

  1. @Override
  2. public java.time.LocalTime convert(LocalTime in, Context context) throws Exception {
  3. if (in == null) return null;
  4. return java.time.LocalTime.of(in.getHourOfDay(), in.getMinuteOfHour(), in.getSecondOfMinute(), in.getMillisOfSecond() * 1000);
  5. }
  6. }

代码示例来源:origin: io.virtdata/virtdata-lib-realer

  1. /**
  2. * Returns a copy of this datetime with the specified time, retaining the date fields.
  3. * <p>
  4. * If the new time is invalid due to the time-zone, the time will be adjusted.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param time the local time
  9. * @return a copy of this datetime with a different time
  10. * @throws IllegalArgumentException if the time-of-day is invalid for the date
  11. * @throws NullPointerException if the time is null
  12. */
  13. public DateTime withTime(LocalTime time) {
  14. return withTime(
  15. time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
  16. }

代码示例来源:origin: Nextdoor/bender

  1. /**
  2. * Returns a copy of this datetime with the specified time, retaining the date fields.
  3. * <p>
  4. * If the new time is invalid due to the time-zone, the time will be adjusted.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param time the local time
  9. * @return a copy of this datetime with a different time
  10. * @throws IllegalArgumentException if the time-of-day is invalid for the date
  11. * @throws NullPointerException if the time is null
  12. */
  13. public DateTime withTime(LocalTime time) {
  14. return withTime(
  15. time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond());
  16. }

代码示例来源:origin: Nextdoor/bender

  1. getYear(), getMonthOfYear(), getDayOfMonth(),
  2. time.getHourOfDay(), time.getMinuteOfHour(),
  3. time.getSecondOfMinute(), time.getMillisOfSecond(), chrono);

相关文章