Package org.springframework.format.datetime

Examples of org.springframework.format.datetime.DateFormatter


    Sample sample = new Sample();
    sample.date = new Date();

    ObjectMapper mapper = context.getBean("objectMapper", ObjectMapper.class);

    DateFormatter formatter = new DateFormatter();
    formatter.setIso(ISO.DATE_TIME);

    Object result = JsonPath.read(mapper.writeValueAsString(sample), "$.date");
    assertThat(result, is(instanceOf(String.class)));
    assertThat(result, is((Object) formatter.print(sample.date, Locale.US)));
  }
View Full Code Here


    }

    @Bean
    @ConditionalOnProperty(prefix = "spring.mvc", name = "date-format")
    public Formatter<Date> dateFormatter() {
      return new DateFormatter(this.mvcProperties.getDateFormat());
    }
View Full Code Here

TOP

Related Classes of org.springframework.format.datetime.DateFormatter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.