Here you can find the source of convertStringToDate(String date, String time)
public static Date convertStringToDate(String date, String time)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import android.util.Log; public class Main { private static String TAG = "DateTimeHelper"; private static String invalidDateFormat = "Invalid date format"; public static Date convertStringToDate(String date, String time) { SimpleDateFormat formatter = new SimpleDateFormat( "dd-MM-yyyy hh:mm a"); String dateString = date + " " + time; Date newDate = null;//from w w w .ja va2 s . com try { newDate = (Date) formatter.parse(dateString); } catch (java.text.ParseException e) { Log.w(TAG, invalidDateFormat); } return newDate; } }