I am working on some application where I need to parse logger stack trace date into required format kindly help me on this..
Date format after parsing logger : [Wed Jul 22 09:29:09 2015] Required format : yyyy-MM-dd HH:mm:ss
I am working on some application where I need to parse logger stack trace date into required format kindly help me on this..
Date format after parsing logger : [Wed Jul 22 09:29:09 2015] Required format : yyyy-MM-dd HH:mm:ss
SimpleDateFormat loggerFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");
SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = loggerFormat.parse("Wed Jul 22 09:29:09 2015");
String output = targetFormat.format(date); // 2015-07-22 09:29:09