If you know which timezone is used in the incoming parameter you can split the string into components and build a DateTime
out of it using valueOf()
method. For example:
String input = '30/20/2010 13:37';
List<String> dateAndTime = input.split(' ');
String date = dateAndTime.get(0);
String time = dateAndTime.get(1);
List<String> dayMonthYear = date.split('/');
List<String> hourMinute = time.split(':');
String day = dayMonthYear.get(0);
String month = dayMonthYear.get(1);
String year = dayMonthYear.get(2);
String hour = hourMinute.get(0);
String minute = hourMinute.get(1);
// You may need to change the concatenation logic based on your locale
String yourLocaleDateTimeString = year + '-' + month + '-' + day + ' ' + hour + ':' + minute;
Datetime output = Datetime.valueOf(yourLocaleDateTimeString);
This will work if the input is always in the same format. It is probably not the best solution, but I can not think of anything better yet(need more coffee)