Unable to obtain ZonedDateTime from TemporalAccessor using DateTimeFormatter and ZonedDateTime in Java 8
I recently moved to Java 8 to, hopefully, deal with local and zoned times more easily. However, I'm facing an, in my opinion, simple problem when parsing a simple date. public static ZonedDateTime convertirAFecha(String fecha) throws Exception { DateTimeFormatter formatter = DateTimeFormatter.ofPattern( ConstantesFechas.FORMATO_DIA).withZone( obtenerZonaHorariaServidor()); ZonedDateTime resultado = ZonedDateTime.parse(fecha, formatter); return resultado; } In my case: fecha is '15/06/2014' ConstantesFechas.FORMATO_DIA is 'dd/MM/yyyy' obtenerZonaHorariaServidor returns ZoneId.systemDefault() So