How to Convert MM/DD/YYYY format to YYYY-MM-DD HH:MM:SS in Java

How to Convert MM/DD/YYYY format Date to DB Format which is YYYY-MM-DD HH:MM:SS  using Java

//Required Imports

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

//Define outputDate variable
Timestamp outputDate = null;
 //input datestring in MM/DD/YYYY format 
String inputDate = "05/16/2013";
try {    
//create a simpledateformat object to read the input date
 SimpleDateFormat fromDate = new SimpleDateFormat("MM/dd/yyyy");
//create one more simpledateformat object to write output date
 SimpleDateFormat toDBFormat = new SimpleDateFormat("yyyy-MM-dd");
//Parse Input Date to Output format as a String
 String reformattedStr = toDBFormat.format(fromDate.parse(inputDate));
//Now Convert the string to Date
 Date parsedDate = toDBFormat.parse(reformattedStr);
//Now finally convert the Date to Timestamp format which is equivalent to MySQL Format
 transactionDate = new java.sql.Timestamp(parsedDate.getTime());
}catch(Exception e) {

MySql Custom Order By using FIELD

I have the following Table : US_States

Id  State
1   CA
2   TX
3   IL
4   MO
5   MI
6   OH
7   CO
8   AZ
9   NY
10 OR

Now I want to display all States in alphabetical order but TX, CA, IL at last. This problem can be solved using FIELD in mysql
FIELD(<FieldName>, Data1, Data2, Data3)


If you don't Give State at the end the above states are displayed in Random Order

Kaspersky Anti Virus 2013 can't be installed : Solved

A few days ago I puchased kaspersky Anti Virus 2013, I have tried to install it, but it cannot be installed after the entire setup is completed. I keep getting error at the end of the Installation which says "Kaspersky AntiVirus 2013 cannot be installed". I have tried all the trouble shooting steps to get that installed by following the below link

My system is running Windows XP Service Pack 3

My computer is neither having any virus not any Antivirus Program. I tried Rescue disk and did all the scanning which took 3-4 hours of my time. All the scanning went in vain.

Next I tried Kaspersky virus Removal Tool, even this failed.

How I solved the Problem Finally :

I downloaded Kaspersky 2012 (older version) from

Exact download link :

This installation went fine and I successfully installed the application and activated it with my 2013 key.

Hope this saves lot of time for any one out there.