java.sql.Date.toInstant()方法的使用及代码示例

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

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

Date.toInstant介绍

暂无

代码示例

代码示例来源:origin: shalousun/ApplicationPower

/**
 * Formats a java.sql.Date using a format string
 *
 * @param date   java.sql.Date
 * @param format format like yyyy-MM-dd
 * @return String
 */
public static String sqlDateToStr(java.sql.Date date, String format) {
  return format(LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()), format);
}

代码示例来源:origin: MarquezProject/marquez

@Override
 public DbTableVersionRow map(@NonNull ResultSet results, @NonNull StatementContext context)
   throws SQLException {
  return DbTableVersionRow.builder()
    .uuid(UUID.fromString(results.getString("uuid")))
    .createdAt(results.getDate("created_at").toInstant())
    .datasetUuid(UUID.fromString(results.getString("dataset_uuid")))
    .dbTableInfoUuid(UUID.fromString(results.getString("db_table_info_uuid")))
    .dbTable(results.getString("db_table"))
    .build();
 }
}

代码示例来源:origin: MarquezProject/marquez

@Override
 public DbTableInfoRow map(@NonNull ResultSet results, @NonNull StatementContext context)
   throws SQLException {
  return DbTableInfoRow.builder()
    .uuid(UUID.fromString(results.getString("uuid")))
    .createdAt(results.getDate("created_at").toInstant())
    .db(results.getString("db"))
    .dbSchema(results.getString("db_schema"))
    .build();
 }
}

代码示例来源:origin: MarquezProject/marquez

@Override
 public DataSourceRow map(@NonNull ResultSet results, @NonNull StatementContext context)
   throws SQLException {
  return DataSourceRow.builder()
    .uuid(UUID.fromString(results.getString("uuid")))
    .createdAt(results.getDate("created_at").toInstant())
    .dataSource(results.getString("data_source"))
    .connectionUrl(results.getString("connection_url"))
    .build();
 }
}

代码示例来源:origin: MarquezProject/marquez

@Override
 public DatasetRow map(@NonNull ResultSet results, @NonNull StatementContext context)
   throws SQLException {
  return DatasetRow.builder()
    .uuid(UUID.fromString(results.getString("uuid")))
    .createdAt(results.getDate("created_at").toInstant())
    .updatedAt(results.getDate("updated_at").toInstant())
    .namespaceUuid(UUID.fromString(results.getString("namespace_uuid")))
    .dataSourceUuid(UUID.fromString(results.getString("data_source_uuid")))
    .urn(results.getString("urn"))
    .description(results.getString("description"))
    .currentVersion(UUID.fromString(results.getString("current_version")))
    .build();
 }
}

相关文章