List of usage examples for java.time LocalDate format
@Override
public String format(DateTimeFormatter formatter)
From source file:com.github.drbookings.LocalDates.java
public static String getDateString(final LocalDate date) { return date.format(DateTimeFormatter.ofPattern("EE, dd MMM")); }
From source file:com.github.drbookings.LocalDates.java
public static String getYearString(final LocalDate date) { return date.format(DateTimeFormatter.ofPattern("yyyy")); }
From source file:com.hotelbeds.hotelapimodel.auto.util.AssignUtils.java
public static String getString(final LocalDate date, final DateTimeFormatter formatter) { return date != null ? date.format(formatter) : null; }
From source file:io.manasobi.utils.DateUtils.java
public static String convertToString(LocalDate date, String pattern) { java.time.format.DateTimeFormatter formatter = java.time.format.DateTimeFormatter.ofPattern(pattern); return date.format(formatter); }
From source file:io.manasobi.utils.DateUtils.java
public static String convertToString(LocalDate date) { java.time.format.DateTimeFormatter formatter = java.time.format.DateTimeFormatter .ofPattern(DATE_PATTERN_DASH); return date.format(formatter); }
From source file:com.romeikat.datamessie.core.base.ui.panel.DocumentsFilterPanel.java
public static String formatLocalDate(final LocalDate localDate) { // No date corresponds to 0 if (localDate == null) { return "0"; }//from w w w. ja v a 2 s .co m // Today corresponds to no date final LocalDate today = LocalDate.now(); if (localDate.equals(today)) { return null; } // Date pattern return localDate.format(DateTimeFormatter.ofPattern(DATE_TIME_PATTERN)); }
From source file:com.mycompany.trafficimportfileconverter2.Main2Controller.java
public static String toWideOrbitTitle(LocalDate ld) { return ld.format(DateTimeFormatter.ofPattern("yyMMdd")); }
From source file:de.lgblaumeiser.ptm.rest.AnalysisControllerTest.java
@Test public void test() throws Exception { ActivityRestController.ActivityBody data = new ActivityRestController.ActivityBody(); data.activityName = "MyTestActivity"; data.bookingNumber = "0815"; mockMvc.perform(//from ww w .j a v a 2 s.c om post("/activities").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsString(data))) .andDo(print()).andExpect(status().isCreated()); LocalDate date = LocalDate.now(); String dateString = date.format(ISO_LOCAL_DATE); BookingRestController.BookingBody booking = new BookingRestController.BookingBody(); booking.activityId = "1"; booking.user = "TestUser"; booking.starttime = LocalTime.of(8, 15).format(ISO_LOCAL_TIME); booking.endtime = LocalTime.of(16, 45).format(ISO_LOCAL_TIME); booking.comment = ""; mockMvc.perform(post("/bookings/" + dateString).contentType(APPLICATION_JSON) .content(objectMapper.writeValueAsString(booking))).andDo(print()).andExpect(status().isCreated()); mockMvc.perform(get("/analysis/hours/" + dateString.substring(0, 7))).andDo(print()) .andExpect(status().isOk()).andExpect(content().string(containsString(dateString))) .andExpect(content().string(containsString("08:15"))) .andExpect(content().string(containsString("16:45"))) .andExpect(content().string(containsString("08:30"))) .andExpect(content().string(containsString("00:00"))); mockMvc.perform(get("/analysis/projects/" + dateString.substring(0, 7))).andDo(print()) .andExpect(status().isOk()).andExpect(content().string(containsString("0815"))) .andExpect(content().string(containsString("08,50"))) .andExpect(content().string(containsString("100"))) .andExpect(content().string(containsString("8"))); }
From source file:com.hotelbeds.hotelapimodel.auto.convert.json.DateSerializer.java
@Override public void serialize(final LocalDate date, final JsonGenerator generator, final SerializerProvider provider) throws IOException { final String dateString = date.format(AssignUtils.REST_FORMATTER); generator.writeString(dateString);//w w w. j av a 2s.co m }
From source file:com.hotelbeds.hotelcontentapi.auto.convert.json.DateSerializer.java
@Override public void serialize(final LocalDate date, final JsonGenerator generator, final SerializerProvider provider) throws IOException { final String dateString = date.format(REST_FORMATTER); generator.writeString(dateString);//from ww w . j a va 2s .c o m }