org.joda.time.format.ISODateTimeFormat#dateTimeNoMillis ( )源码实例Demo

下面列出了org.joda.time.format.ISODateTimeFormat#dateTimeNoMillis ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: omise-java   文件: Serializer.java
private Serializer() {
    dateTimeFormatter = ISODateTimeFormat.dateTimeNoMillis();
    localDateFormatter = ISODateTimeFormat.date();

    objectMapper = new ObjectMapper()
            .registerModule(new JodaModule()
                    .addSerializer(DateTime.class, new DateTimeSerializer()
                            .withFormat(new JacksonJodaDateFormat(dateTimeFormatter), 0)
                    )
                    .addSerializer(LocalDate.class, new LocalDateSerializer()
                            .withFormat(new JacksonJodaDateFormat(localDateFormatter), 0)
                    )
            )

            .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
            .configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, true)
            .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
            .configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); // TODO: Deprecate in vNext
}
 
源代码2 项目: Bats   文件: PrimitiveColumnMetadata.java
@Override
public DateTimeFormatter dateTimeFormatter() {
  String formatValue = format();
  try {
    switch (type) {
      case TIME:
        return formatValue == null
          ? ISODateTimeFormat.localTimeParser() : DateTimeFormat.forPattern(formatValue);
      case DATE:
        formatValue = format();
        return formatValue == null
          ? ISODateTimeFormat.localDateParser() : DateTimeFormat.forPattern(formatValue);
      case TIMESTAMP:
        formatValue = format();
        return formatValue == null
          ? ISODateTimeFormat.dateTimeNoMillis() : DateTimeFormat.forPattern(formatValue);
      default:
        throw new IllegalArgumentException("Column is not a date/time type: " + type.toString());
    }
  } catch (IllegalArgumentException e) {
    throw new IllegalArgumentException(String.format("The format \"%s\" is not valid for type %s",
        formatValue, type), e);
  }
}
 
源代码3 项目: actframework   文件: JodaLocalDateTimeCodec.java
@Override
protected DateTimeFormatter isoFormatter() {
    return ISODateTimeFormat.dateTimeNoMillis();
}
 
源代码4 项目: attic-rave   文件: ModelUtil.java
public static Date stringToDate(String dateString){
    DateTimeFormatter fmt = ISODateTimeFormat.dateTimeNoMillis();
    return fmt.parseDateTime(dateString).toDate();
}
 
源代码5 项目: attic-rave   文件: ModelUtil.java
public static String dateToString(Date date){
    DateTimeFormatter fmt = ISODateTimeFormat.dateTimeNoMillis();
    DateTime dateTime = new DateTime(date);
    return fmt.print(dateTime);
}