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

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

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

LocalTime.getMillisOfDay介绍

[英]Get the millis of day field value.
[中]获取天的毫秒字段值。

代码示例

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

  1. @Override
  2. public void write(Kryo kryo, Output output, LocalTime object) {
  3. final int time = object.getMillisOfDay();
  4. output.writeInt(time, true);
  5. final Chronology chronology = object.getChronology();
  6. if (chronology != null && chronology != ISOChronology.getInstanceUTC()) {
  7. throw new RuntimeException("Unsupported chronology: " + chronology);
  8. }
  9. }

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

  1. @Override
  2. public long getLong(int field)
  3. {
  4. checkState(row != null, "No current row");
  5. Column column = columns.get(field);
  6. if (column.getType().getBase() == ColumnType.Base.DATE) {
  7. return Days.daysBetween(new LocalDate(0), LocalDate.parse(row.get(column.getPosition()))).getDays();
  8. }
  9. if (column.getType().getBase() == ColumnType.Base.TIME) {
  10. return LocalTime.parse(row.get(column.getPosition())).getMillisOfDay();
  11. }
  12. if (column.getType().getBase() == ColumnType.Base.INTEGER) {
  13. return parseInt(row.get(column.getPosition()));
  14. }
  15. if (column.getType().getBase() == ColumnType.Base.DECIMAL) {
  16. DecimalParseResult decimalParseResult = Decimals.parse(row.get(column.getPosition()));
  17. return rescale((Long) decimalParseResult.getObject(), decimalParseResult.getType().getScale(), ((DecimalType) columnTypes.get(field)).getScale());
  18. }
  19. return parseLong(row.get(column.getPosition()));
  20. }

代码示例来源:origin: ebean-orm/ebean

  1. @Override
  2. public Object toJdbcType(Object value) {
  3. if (value instanceof LocalTime) {
  4. return new Time(((LocalTime) value).getMillisOfDay());
  5. }
  6. return BasicTypeConverter.toTime(value);
  7. }

代码示例来源:origin: ebean-orm/ebean

  1. @Override
  2. public void bind(DataBind b, LocalTime value) throws SQLException {
  3. if (value == null) {
  4. b.setNull(Types.TIME);
  5. } else {
  6. Time sqlTime = new Time(value.getMillisOfDay());
  7. b.setTime(sqlTime);
  8. }
  9. }

代码示例来源:origin: org.springframework.data/spring-data-cassandra

  1. @Override
  2. public Long convert(LocalTime source) {
  3. return (long) source.getMillisOfDay();
  4. }
  5. }

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

  1. @Override
  2. public Long toNonNullValue(LocalTime value) {
  3. return Long.valueOf(value.getMillisOfDay() * 1000000L);
  4. }
  5. }

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

  1. @Override
  2. public Long toNonNullValue(TimeOfDay value) {
  3. return Long.valueOf((value.toLocalTime().getMillisOfDay()) * 1000000L);
  4. }
  5. }

代码示例来源:origin: io.ebean/ebean

  1. @Override
  2. public Object toJdbcType(Object value) {
  3. if (value instanceof LocalTime) {
  4. return new Time(((LocalTime) value).getMillisOfDay());
  5. }
  6. return BasicTypeConverter.toTime(value);
  7. }

代码示例来源:origin: net.s-jr.utils.converterutils/joda-converter-utils

  1. @Contract("null -> null; !null -> !null")
  2. public static @Nullable Time jodaTimeToSqlTime(final @Nullable LocalTime value) {
  3. if (value == null) {
  4. return null;
  5. }
  6. return new Time(value.getMillisOfDay());
  7. }

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

  1. public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException {
  2. if (value == null) {
  3. StandardBasicTypes.INTEGER.nullSafeSet(preparedStatement, null, index);
  4. } else {
  5. LocalTime lt = ((LocalTime) value);
  6. StandardBasicTypes.INTEGER.nullSafeSet(preparedStatement, new Integer(lt.getMillisOfDay()), index);
  7. }
  8. }

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

  1. public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException {
  2. if (value == null) {
  3. StandardBasicTypes.TIMESTAMP.nullSafeSet(preparedStatement, null,
  4. index);
  5. } else {
  6. LocalTime lt = ((LocalTime) value);
  7. Timestamp timestamp = new Timestamp(lt.getMillisOfDay());
  8. StandardBasicTypes.TIMESTAMP.nullSafeSet(preparedStatement,
  9. timestamp, index);
  10. }
  11. }

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

  1. public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException {
  2. if (value == null) {
  3. StandardBasicTypes.TIME.nullSafeSet(preparedStatement, null, index);
  4. } else {
  5. LocalTime lt = ((LocalTime) value);
  6. Time time = new Time(lt.getMillisOfDay());
  7. StandardBasicTypes.TIME.nullSafeSet(preparedStatement, time, index);
  8. }
  9. }

代码示例来源:origin: org.avaje.ebean/ebean

  1. @Override
  2. public void bind(DataBind b, LocalTime value) throws SQLException {
  3. if (value == null) {
  4. b.setNull(Types.TIME);
  5. } else {
  6. Time sqlTime = new Time(value.getMillisOfDay());
  7. b.setTime(sqlTime);
  8. }
  9. }

代码示例来源:origin: com.alibaba.blink/flink-avro

  1. @Override
  2. public void write(Kryo kryo, Output output, LocalTime object) {
  3. final int time = object.getMillisOfDay();
  4. output.writeInt(time, true);
  5. final Chronology chronology = object.getChronology();
  6. if (chronology != null && chronology != ISOChronology.getInstanceUTC()) {
  7. throw new RuntimeException("Unsupported chronology: " + chronology);
  8. }
  9. }

代码示例来源:origin: dremio/dremio-oss

  1. @Override
  2. public void set(ValueVector v, int index) {
  3. if(obj != null){
  4. ((TimeMilliVector) v).setSafe(index, (int) obj.getMillisOfDay());
  5. }
  6. }

代码示例来源:origin: org.apache.isis.viewer/isis-viewer-restfulobjects-applib

  1. private java.util.Date getTime(final String path, final JsonNode node) {
  2. if (representsNull(node)) {
  3. return null;
  4. }
  5. checkValue(path, node, "a time");
  6. if (!node.isTextual()) {
  7. throw new IllegalArgumentException(formatExMsg(path, "is not a time"));
  8. }
  9. final String textValue = node.getTextValue();
  10. final LocalTime localTime = _HHmmss.parseLocalTime(textValue + "Z");
  11. return new java.util.Date(localTime.getMillisOfDay());
  12. }

代码示例来源:origin: com.synaptix.toast/toast-tk-adapters

  1. public static Duration parseDurationFromTime(String time) {
  2. if (StringUtils.isEmpty(time)) {
  3. return null;
  4. }
  5. return Duration.millis(LocalTime.parse(time, new DateTimeFormatterBuilder().appendPattern(TimePattern).toFormatter()).getMillisOfDay());
  6. }

代码示例来源:origin: de.javakaffee/kryo-serializers

  1. @Override
  2. public void write(Kryo kryo, Output output, LocalTime object) {
  3. final int time = object.getMillisOfDay();
  4. output.writeInt(time, true);
  5. //LocalTime always converts the internal DateTimeZone to UTC so there is no need to serialize it.
  6. final String chronologyId = IdentifiableChronology.getChronologyId(object.getChronology());
  7. output.writeString(chronologyId);
  8. }

代码示例来源:origin: magro/kryo-serializers

  1. @Override
  2. public void write(Kryo kryo, Output output, LocalTime object) {
  3. final int time = object.getMillisOfDay();
  4. output.writeInt(time, true);
  5. //LocalTime always converts the internal DateTimeZone to UTC so there is no need to serialize it.
  6. final String chronologyId = IdentifiableChronology.getChronologyId(object.getChronology());
  7. output.writeString(chronologyId);
  8. }

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

  1. @Test
  2. public void testLocalTime()
  3. throws Exception
  4. {
  5. long millis = new LocalTime(session.getStartTime(), DATE_TIME_ZONE).getMillisOfDay();
  6. functionAssertions.assertFunction("LOCALTIME", TimeType.TIME, toTime(millis));
  7. }

相关文章