Facing MapperParsingException[failed to parse [date]]


(john rabindranath) #1

Hi Team ,
can anyone help me to resolve this issue ?

while converting milliseconds to date facing this exception while indexing time ,
Date dates = new Date(1532390400000L);
Date convertedDate = new SimpleDateFormat("yyyy-MM-dd").parse(fmt.format(dates));
elasticUpdated.setDate(convertedDate);

SimpleDateFormat fmts = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

		mapper.setDateFormat(fmts);
		String stringifiedJson = mapper.writeValueAsString(elasticUpdated);

		bulkRequests.add(esclient.prepareIndex("index", "type", elasticUpdated.getId())
				.setSource(stringifiedJson));

Exception
essage [MapperParsingException[failed to parse 2018-11-01 07:11:54; nested: IllegalArgumentException[Invalid format: "2018-07-24 00:00:00" is malformed at " 00:00:00"];]


(Christoph) #2

What does "fmt" refer to?


(john rabindranath) #3

hi @cbuescher,

fmt refer to below one
SimpleDateFormat fmts = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.