on 2013 Nov 25 5:27 AM
Hi,
I am exporting the data of any table in which there is field like CREATED_ON whoese datatype is date time.
While exporting value of the field is 2013-11-18 15:37:47.123 When I am going to convert the above value into java.Util.Date. I am writing following
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date; date = formatter.parse(columnValue); System.out.println("yyyy-MM-dd HH:mm:ss "+date);
Error is coming due to "15:37:47.123" format malformed. Because extra value ".123" after HH:mm:ss is giving error. When I remove the extra ".123" error is gone.
So any one tell what is this extra value and how can I parse it in same format by giving correct date format.
Request clarification before answering.
This is solution what I got...
String columnValue="2013-11-18 15:37:47.000"; DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); Date date; date = formatter.parse(columnValue);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've had the same problem, and it's even more complex because you forgot that a time zone might also be involved.
Here is my potential solution, in another answered question: JDBC Retrieving timestamp with Time Zone
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
60 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.