APISonar


org.springframework.format.annotation.DateTimeFormat.ISO.TIME

> org > springframework > format > annotation > DateTimeFormat > ISO > TIME
org APIs springframework APIs format APIs annotation APIs DateTimeFormat APIs ISO APIs TIME APIs

Example 1
private DateTimeFormatter forIso(ISO iso) {
		if (iso == ISO.DATE) {
			return org.joda.time.format.ISODateTimeFormat.date();
		}
		else if (iso == ISO.TIME) {
			return org.joda.time.format.ISODateTimeFormat.time();
		}
		else {
			return org.joda.time.format.ISODateTimeFormat.dateTime();
		}		
	}
Example 2
public void shouldParseIsoTimeWithZeros() throws Exception {
		DateFormatter formatter = new DateFormatter();
		formatter.setIso(ISO.TIME);
		Date date = formatter.parse("12:00:00.000-00005", Locale.US);
		System.out.println(date);
	}
Example 3
public void shouldPrintAndParseISOTime() throws Exception {
		DateFormatter formatter = new DateFormatter();
		formatter.setTimeZone(UTC);
		formatter.setIso(ISO.TIME);
		Date date = getDate(2009, Calendar.JANUARY, 1, 14, 23, 5, 3);
		assertThat(formatter.print(date, Locale.US), is("14:23:05.003+0000"));
		assertThat(formatter.parse("14:23:05.003+0000", Locale.US),
				is(getDate(1970, Calendar.JANUARY, 1, 14, 23, 5, 3)));
	}