I am storing date in my DB, before I am taking date in MM/DD/YYYY
format, I am taking data from user using textbox. But now I want time as well so I am taking date from user and time automatically attaching with user inputted date.
I am getting date + time
like :
05/07/2014 8:55:3.522
I have used following code to parse this date and store it into DB, I want to store date in following format :
2014-05-07 8:55:3.522 // here format is YYYY-MM-DD and time
Code :
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
Date parsedDate = dateFormat.parse(getCheckOutDate());
Timestamp timestamp = new Timestamp(parsedDate.getTime());
I am confused that how to parse received date and change it's format and save into DB.
When I try above code it doesn't parse date.
Any guidance on it. Thank You.