import java.text.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        String myDate = "2-5-2012";
        String myTime = "20:43";
        String toParse = myDate + " " + myTime; // Results in "2-5-2012 20:43"
        try {
            SimpleDateFormat formatter = new SimpleDateFormat("d-M-yyyy hh:mm"); // I assume d-M, you may refer to M-d for month-day instead.
            Date date = formatter.parse(toParse); // You will need try/catch around this
            long millis = date.getTime();
            System.out.println(millis);
        } catch (ParseException pe) {
            pe.printStackTrace();
        }
    }
}