List of usage examples for java.time.format DateTimeFormatter ISO_LOCAL_DATE_TIME
DateTimeFormatter ISO_LOCAL_DATE_TIME
To view the source code for java.time.format DateTimeFormatter ISO_LOCAL_DATE_TIME.
Click Source Link
From source file:Main.java
public static String getCurrentTimeStamp() { Clock clock = Clock.system(ZoneId.of("Europe/Berlin")); ZonedDateTime now = ZonedDateTime.now(clock); return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(now); }
From source file:Main.java
public static LocalDateTime getLocalDateTimeFromDB(ResultSet rs, String column) throws SQLException { String date = rs.getString(column); if (date != null) { return LocalDateTime.parse(date, DateTimeFormatter.ISO_LOCAL_DATE_TIME); } else {//from ww w . ja va2s . c om return null; } }
From source file:Main.java
public static String getDBValueFromLocalDateTime(LocalDateTime start) { if (start != null) { return start.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); } else {/*from w ww. j a v a 2 s. c o m*/ return null; } }
From source file:com.codepalousa.restlet.raml.DateTimeDeserializeConverter.java
public DateTimeDeserializeConverter() { formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; }
From source file:com.codepalousa.restlet.raml.DateTimeSerializeConverter.java
public DateTimeSerializeConverter() { formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; }
From source file:com.bekwam.mavenpomupdater.ErrorLogDelegate.java
public void log(String fileName, String message) { if (log.isDebugEnabled()) { log.debug("[LOG] fileName=" + fileName + ", message=" + message); }/*from w w w .j a v a 2 s. c o m*/ LocalDateTime now = LocalDateTime.now(); String logTime = now.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); tblErrors.getItems().add(new ErrorLogEntry(logTime, fileName, message)); }
From source file:com.example.database.DatabaseApp.java
@Bean public ObjectMapper jsonObjectMapper() { final JavaTimeModule module = new JavaTimeModule(); module.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ISO_LOCAL_DATE_TIME)); module.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ISO_LOCAL_DATE)); final ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(module);//from w w w . ja v a 2s . co m mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); return mapper; }
From source file:com.fizzed.stork.deploy.DeployHelper.java
static public String toFriendlyDateTime(long millis) { Instant instant = Instant.ofEpochMilli(millis); LocalDateTime ldt = LocalDateTime.ofInstant(instant, ZoneOffset.UTC); return ldt.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); }
From source file:com.mgmtp.perfload.core.console.meta.LtMetaInfoHandlerTest.java
@Test public void testMetaInfoForLoadProfileTest() throws Exception { XmlConfigReader reader = new XmlConfigReader(new File("src/test/resources"), "testplan_loadprofile.xml"); ZonedDateTime now = ZonedDateTime.now(); Properties props = createMetaProperties(reader, now); String timestamp = DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(now); assertEquals(props.getProperty("test.file"), "testplan_loadprofile.xml"); assertEquals(props.getProperty("test.start"), timestamp); assertEquals(props.getProperty("test.finish"), timestamp); assertEquals(props.getProperty("daemon.1"), "localhost:8042"); assertEquals(props.getProperty("daemon.2"), "localhost:8043"); assertEquals(props.getProperty("targets"), "myTarget1,myTarget2"); assertEquals(props.getProperty("operations"), "myOperation1,myOperation2,myOperation3,myOperation4,myOperation5,myOperation6"); assertEquals(props.getProperty("executions.myOperation1.myTarget1"), "1"); assertEquals(props.getProperty("executions.myOperation1.myTarget2"), "1"); assertEquals(props.getProperty("executions.myOperation2.myTarget1"), "2"); assertEquals(props.getProperty("executions.myOperation2.myTarget2"), "2"); assertEquals(props.getProperty("executions.myOperation3.myTarget1"), "1"); assertEquals(props.getProperty("executions.myOperation3.myTarget2"), "0"); assertEquals(props.getProperty("executions.myOperation4.myTarget1"), "3"); assertEquals(props.getProperty("executions.myOperation4.myTarget2"), "0"); assertEquals(props.getProperty("executions.myOperation5.myTarget1"), "0"); assertEquals(props.getProperty("executions.myOperation5.myTarget2"), "1"); assertEquals(props.getProperty("executions.myOperation6.myTarget1"), "0"); assertEquals(props.getProperty("executions.myOperation6.myTarget2"), "4"); }
From source file:ch.aschaefer.udp.DatagramSocketToControlMessageConverter.java
@Override public ControlMessage convert(DatagramPacket source) { return new ControlMessage().timestamp(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(LocalDateTime.now())) .hex(toHex(source.getData())).source(source.getSocketAddress().toString()) .targetHost(source.getAddress().getHostAddress()).targetPort(source.getPort()); }