I would like to convert a String object in java to a Datetime. The String has the following format:
ddMMyyyyhhmm
I wonder if there is a short way to do it.
I would like to convert a String object in java to a Datetime. The String has the following format:
ddMMyyyyhhmm
I wonder if there is a short way to do it.
try to use Simple date formatter, like:
SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyyhhmm");// or any date format you want
Date date = sdf.parse(s);
Something like this?
String string = "date string here"
DateTimeFormatter formatter = DateTimeFormat.forPattern("ddMMyyyyHHmm");
DateTime dt = formatter.parseDateTime(string);