Converting a date string to a DateTime object using Joda Time library
Include the following imports in the class
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
The following will convert date String to Date Time
DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss");
DateTime dateTime = formatter.parseDateTime(dateString);
No comments:
Post a Comment