Java Code Examples for java.time.format.DateTimeFormatter#ISO_LOCAL_DATE_TIME
The following examples show how to use
java.time.format.DateTimeFormatter#ISO_LOCAL_DATE_TIME .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Jsr310DateTimeFormatAnnotationFormatterFactory.java From java-technology-stack with MIT License | 6 votes |
@Override public Printer<?> getPrinter(DateTimeFormat annotation, Class<?> fieldType) { DateTimeFormatter formatter = getFormatter(annotation, fieldType); // Efficient ISO_LOCAL_* variants for printing since they are twice as fast... if (formatter == DateTimeFormatter.ISO_DATE) { if (isLocal(fieldType)) { formatter = DateTimeFormatter.ISO_LOCAL_DATE; } } else if (formatter == DateTimeFormatter.ISO_TIME) { if (isLocal(fieldType)) { formatter = DateTimeFormatter.ISO_LOCAL_TIME; } } else if (formatter == DateTimeFormatter.ISO_DATE_TIME) { if (isLocal(fieldType)) { formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; } } return new TemporalAccessorPrinter(formatter); }
Example 2
Source File: Jsr310DateTimeFormatAnnotationFormatterFactory.java From spring-analysis-note with MIT License | 6 votes |
@Override public Printer<?> getPrinter(DateTimeFormat annotation, Class<?> fieldType) { DateTimeFormatter formatter = getFormatter(annotation, fieldType); // Efficient ISO_LOCAL_* variants for printing since they are twice as fast... if (formatter == DateTimeFormatter.ISO_DATE) { if (isLocal(fieldType)) { formatter = DateTimeFormatter.ISO_LOCAL_DATE; } } else if (formatter == DateTimeFormatter.ISO_TIME) { if (isLocal(fieldType)) { formatter = DateTimeFormatter.ISO_LOCAL_TIME; } } else if (formatter == DateTimeFormatter.ISO_DATE_TIME) { if (isLocal(fieldType)) { formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; } } return new TemporalAccessorPrinter(formatter); }
Example 3
Source File: PutSQL.java From localization_nifi with Apache License 2.0 | 6 votes |
private DateTimeFormatter getDateTimeFormatter(String pattern) { switch(pattern) { case "BASIC_ISO_DATE": return DateTimeFormatter.BASIC_ISO_DATE; case "ISO_LOCAL_DATE": return DateTimeFormatter.ISO_LOCAL_DATE; case "ISO_OFFSET_DATE": return DateTimeFormatter.ISO_OFFSET_DATE; case "ISO_DATE": return DateTimeFormatter.ISO_DATE; case "ISO_LOCAL_TIME": return DateTimeFormatter.ISO_LOCAL_TIME; case "ISO_OFFSET_TIME": return DateTimeFormatter.ISO_OFFSET_TIME; case "ISO_TIME": return DateTimeFormatter.ISO_TIME; case "ISO_LOCAL_DATE_TIME": return DateTimeFormatter.ISO_LOCAL_DATE_TIME; case "ISO_OFFSET_DATE_TIME": return DateTimeFormatter.ISO_OFFSET_DATE_TIME; case "ISO_ZONED_DATE_TIME": return DateTimeFormatter.ISO_ZONED_DATE_TIME; case "ISO_DATE_TIME": return DateTimeFormatter.ISO_DATE_TIME; case "ISO_ORDINAL_DATE": return DateTimeFormatter.ISO_ORDINAL_DATE; case "ISO_WEEK_DATE": return DateTimeFormatter.ISO_WEEK_DATE; case "ISO_INSTANT": return DateTimeFormatter.ISO_INSTANT; case "RFC_1123_DATE_TIME": return DateTimeFormatter.RFC_1123_DATE_TIME; default: return DateTimeFormatter.ofPattern(pattern); } }
Example 4
Source File: Jsr310DateTimeFormatAnnotationFormatterFactory.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public Printer<?> getPrinter(DateTimeFormat annotation, Class<?> fieldType) { DateTimeFormatter formatter = getFormatter(annotation, fieldType); // Efficient ISO_LOCAL_* variants for printing since they are twice as fast... if (formatter == DateTimeFormatter.ISO_DATE) { if (isLocal(fieldType)) { formatter = DateTimeFormatter.ISO_LOCAL_DATE; } } else if (formatter == DateTimeFormatter.ISO_TIME) { if (isLocal(fieldType)) { formatter = DateTimeFormatter.ISO_LOCAL_TIME; } } else if (formatter == DateTimeFormatter.ISO_DATE_TIME) { if (isLocal(fieldType)) { formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; } } return new TemporalAccessorPrinter(formatter); }
Example 5
Source File: JdbcCommon.java From nifi with Apache License 2.0 | 6 votes |
public static DateTimeFormatter getDateTimeFormatter(String pattern) { switch(pattern) { case "BASIC_ISO_DATE": return DateTimeFormatter.BASIC_ISO_DATE; case "ISO_LOCAL_DATE": return DateTimeFormatter.ISO_LOCAL_DATE; case "ISO_OFFSET_DATE": return DateTimeFormatter.ISO_OFFSET_DATE; case "ISO_DATE": return DateTimeFormatter.ISO_DATE; case "ISO_LOCAL_TIME": return DateTimeFormatter.ISO_LOCAL_TIME; case "ISO_OFFSET_TIME": return DateTimeFormatter.ISO_OFFSET_TIME; case "ISO_TIME": return DateTimeFormatter.ISO_TIME; case "ISO_LOCAL_DATE_TIME": return DateTimeFormatter.ISO_LOCAL_DATE_TIME; case "ISO_OFFSET_DATE_TIME": return DateTimeFormatter.ISO_OFFSET_DATE_TIME; case "ISO_ZONED_DATE_TIME": return DateTimeFormatter.ISO_ZONED_DATE_TIME; case "ISO_DATE_TIME": return DateTimeFormatter.ISO_DATE_TIME; case "ISO_ORDINAL_DATE": return DateTimeFormatter.ISO_ORDINAL_DATE; case "ISO_WEEK_DATE": return DateTimeFormatter.ISO_WEEK_DATE; case "ISO_INSTANT": return DateTimeFormatter.ISO_INSTANT; case "RFC_1123_DATE_TIME": return DateTimeFormatter.RFC_1123_DATE_TIME; default: return DateTimeFormatter.ofPattern(pattern); } }
Example 6
Source File: ServerBuilder.java From baratine with GNU General Public License v2.0 | 6 votes |
private void logCopyright() { if (CurrentTime.isTest() || config().get("quiet",boolean.class,false)) { return; } System.out.println(Version.getFullVersion()); System.out.println(Version.getCopyright()); System.out.println(); DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; Instant instant = Instant.ofEpochMilli(getStartTime()); System.out.println("Starting " + getProgramName() + " on " + formatter.format(instant)); System.out.println(); }
Example 7
Source File: WebServerBuilderImpl.java From baratine with GNU General Public License v2.0 | 6 votes |
private void logCopyright() { if (CurrentTime.isTest() || config().get("quiet",boolean.class,false)) { return; } System.out.println(Version.getFullVersion()); System.out.println(Version.getCopyright()); System.out.println(); DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; Instant instant = Instant.ofEpochMilli(startTime()); System.out.println("Starting " + getProgramName() + " on " + formatter.format(instant.atZone(ZoneId.systemDefault()))); System.out.println(); }
Example 8
Source File: TimestampToStringConverterTest.java From tutorials with MIT License | 5 votes |
@Test public void givenDatePattern_whenFormatting_thenResultingStringIsCorrect() { Timestamp timestamp = Timestamp.valueOf("2018-12-12 01:02:03.123456789"); DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; String timestampAsString = formatter.format(timestamp.toLocalDateTime()); Assert.assertEquals("2018-12-12T01:02:03.123456789", timestampAsString); }
Example 9
Source File: JVMStatusTelnetHandler.java From joyrpc with Apache License 2.0 | 5 votes |
@Override public TelnetResponse telnet(Channel channel, String[] args) { if (args != null && args.length != 0) { return new TelnetResponse(help()); } StringBuilder sb = new StringBuilder(1024); //内存使用情况 MemoryMXBean mmxb = ManagementFactory.getMemoryMXBean(); long max = mmxb.getHeapMemoryUsage().getMax(); long used = mmxb.getHeapMemoryUsage().getUsed(); long init = mmxb.getHeapMemoryUsage().getInit(); long commit = mmxb.getHeapMemoryUsage().getCommitted(); sb.append("********Memory status******************").append(LINE); sb.append("Max JVM Heap Memory:").append(max / 1024 / 1024).append("M").append(LINE) .append("Used Heap Memory:").append(used / 1024 / 1024).append("M").append(LINE) .append("Init Heap Memory:").append(init / 1024 / 1024).append("M").append(LINE) .append("Commited Heap Memory:").append(commit / 1024 / 1024).append("M").append(LINE); sb.append("********Thread status********************").append(LINE); //线程数 ThreadMXBean txmb = ManagementFactory.getThreadMXBean(); sb.append("Peak thread count:").append(txmb.getPeakThreadCount()).append(LINE) .append("Thread count:").append(txmb.getThreadCount()).append(LINE); sb.append("********Runtime status******************").append(LINE); //启动入口参数 RuntimeMXBean rmxb = ManagementFactory.getRuntimeMXBean(); sb.append("InputArguments:["); for (String ia : rmxb.getInputArguments()) { sb.append(ia).append(","); } sb.deleteCharAt(sb.length() - 1).append("]").append(LINE); DateTimeFormatter dtf = DateTimeFormatter.ISO_LOCAL_DATE_TIME; LocalDateTime localDateTime = Instant.ofEpochMilli(rmxb.getStartTime()).atZone(ZoneId.systemDefault()).toLocalDateTime(); sb.append("JVM start time:").append(dtf.format(localDateTime)).append(LINE); return new TelnetResponse(sb.toString()); }
Example 10
Source File: LocalDateTimeSerializer.java From jackson-modules-java8 with Apache License 2.0 | 4 votes |
protected DateTimeFormatter _defaultFormatter() { return DateTimeFormatter.ISO_LOCAL_DATE_TIME; }
Example 11
Source File: LocalDateTimeDeserializer.java From bootique with Apache License 2.0 | 4 votes |
private LocalDateTimeDeserializer() { this(DateTimeFormatter.ISO_LOCAL_DATE_TIME); }
Example 12
Source File: DateTimeTypeAdapter.java From jsonstream with Apache License 2.0 | 4 votes |
public DateTimeTypeAdapter() { this.formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; }
Example 13
Source File: LocalDateTimeXmlAdapter.java From threeten-jaxb with Apache License 2.0 | 4 votes |
public LocalDateTimeXmlAdapter() { super(DateTimeFormatter.ISO_LOCAL_DATE_TIME, LocalDateTime::from); }
Example 14
Source File: DateTimeTypeAdapter.java From jsonstream with Apache License 2.0 | 4 votes |
public DateTimeTypeAdapter() { this.formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; }
Example 15
Source File: ParseLocalDateTimeTest.java From super-csv with Apache License 2.0 | 4 votes |
@Test public void testConstructor4WithNullNext() { exception.expect(NullPointerException.class); new ParseLocalDateTime(DateTimeFormatter.ISO_LOCAL_DATE_TIME, null); }
Example 16
Source File: FmtLocalDateTimeTest.java From super-csv with Apache License 2.0 | 4 votes |
@Test() public void testConstructor4WithNullNext() { exception.expect(NullPointerException.class); new FmtLocalDateTime(DateTimeFormatter.ISO_LOCAL_DATE_TIME, null); }
Example 17
Source File: JavaTimeTypesParamConverterProvider.java From cxf with Apache License 2.0 | 4 votes |
protected DateTimeFormatter getFormatter() { return DateTimeFormatter.ISO_LOCAL_DATE_TIME; }
Example 18
Source File: TCKDTFParsedInstant.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider="parseWithoutZoneWithoutOffset") public void testWithoutZoneWithoutOffset(String ldtString, LocalDateTime expectedLDT) { dtFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; ldt1 = LocalDateTime.parse(ldtString, dtFormatter); assertEquals(expectedLDT, ldt1); }