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

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

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

LocalTime.getSecondOfMinute介绍

[英]Get the second of minute field value.
[中]获取分钟的秒字段值。

代码示例

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

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

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

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

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

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

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

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

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

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

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

public void setParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException
{
  LocalTime time = (LocalTime) parameter;
  if (time != null)
  {
    DateTime datetime = new DateTime(1970, 1, 1, time.getHourOfDay(), time.getMinuteOfHour(),
        time.getSecondOfMinute(), 0);
    ps.setTime(i, new Time(datetime.toDate().getTime()));
  }
  else
  {
    ps.setTime(i, null);
  }
}

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

@Override
  public String toNonNullValue(LocalTime value) {
    if (value.getMillisOfSecond() == 0) {
      if (value.getSecondOfMinute() == 0) {
        return Formatter.LOCAL_TIME_NOSECONDS_PRINTER.print(value);
      }
      return Formatter.LOCAL_TIME_NOMILLIS_PRINTER.print(value);
    } else {
      return value.toString();
    }
  }
}

代码示例来源:origin: fenix-framework/fenix-framework

public static java.sql.Time getValueForLocalTime(LocalTime value) {
  // Creating the java.sql.Time with hours, minutes, and seconds
  // creates an instant interpreting those values in the default
  // time zone.  This is needed because currently OJB is sending
  // instances of TIME to a preparedStatement without specifying
  // the time zone, which means that it will be interpreted as
  // being the default time zone.
  //
  // So, beware, that we may not change this into a new
  // java.sql.Time(value.getMillisOfDay()), because, in that
  // case, the millis would be interpreted as being an instant
  // relative to the 01/01/1970 00:00:00 GMT.
  return (value == null ? null : new java.sql.Time(value.getHourOfDay(), value.getMinuteOfHour(), value.getSecondOfMinute()));
}

代码示例来源:origin: org.jresearch.commons.base/org.jresearch.commons.base.domain

public static java.time.LocalTime localJodaJavaTime(@Nonnull final LocalTime time) {
  return java.time.LocalTime.of(time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute());
}

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

LocalTime localTime = new LocalTime(1,0,0,0);
java.sql.Time sqlTime = new java.sql.Time(localTime.getHourOfDay(), localTime.getMinuteOfHour(), localTime.getSecondOfMinute())

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

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

代码示例来源:origin: FenixEdu/fenixedu-academic

/**
 * Constructs a HourMinuteSecond from a LocalTime, using exactly the same
 * fields, but ignoring the millis.
 * 
 * @return the created HourMinuteSecond
 */
public static HourMinuteSecond fromLocalTime(LocalTime time) {
  return new HourMinuteSecond(time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute());
}

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

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

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

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

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

Date datePart= ...;           // The date parsed from the first user input
String userTimeInput = ...;   // The time of day from the user
Locale userLocale = ...;
DateTimeZone userTimeZone = ...;

DateTime dateInUserTimeZone = new DateTime(datePart, userTimeZone);
DateTimeFormatter formatter = DateTimeFormat.shortTime().withLocale(userLocale);
LocalTime time = formatter.parseLocalTime(userTimeInput);

Date newDate = dateInUserTimeZone.withTime(time.getHourOfDay(), time.getMinuteOfHour(),
    time.getSecondOfMinute(), time.getMillisOfSecond()).toDate();

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

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

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

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

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

@Override
  public Timestamp toNonNullValue(LocalTime value) {

    DateTime zonedValue = new LocalDateTime(
        1970,1,1,value.getHourOfDay(), value.getMinuteOfHour(), value.getSecondOfMinute(), value.getMillisOfSecond(), value.getChronology()
    ).toDateTime();

    final Timestamp timestamp = new Timestamp(zonedValue.getMillis());
    return timestamp;
  }
}

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

@Override
  public Time toNonNullValue(LocalTime value) {

    DateTime zonedValue = new LocalDateTime(
        1970,1,1,value.getHourOfDay(), value.getMinuteOfHour(), value.getSecondOfMinute(), value.getMillisOfSecond(), value.getChronology()
    ).toDateTime();

    final Time time = new Time(zonedValue.getMillis());
    return time;
  }
}

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

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

相关文章