yyyy-mm-dd and hh:mm (PM/AM) convert into long
问题 I have two strings: String date = "2011-11-11" String time="11:00 PM" i want to merge this date and time and convert them into a long, similar to System.currentTimeMillis(). 回答1: try this it is working fine String inputDate=date+" "+time ;; long parsedDate = HttpDateParser.parse(inputDate);//inputDate should 2011-12-11 11:10:00 PM" formate System.out.println("========================="+parsedDate); Date date=new Date(parsedDate); SimpleDateFormat date1=new SimpleDateFormat("yyyy-mm-dd hh:mm