I am currently working on converting from date to string. After that, I convert this string to datetime. But this is a mistake. Can anybody help me?
Here is the code.
import org.joda.time.DateTime import org.joda.time.format.DateTimeFormat import org.joda.time.format.DateTimeFormatter import java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; SimpleDateFormat outFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String dt1 = outFormat.format(date1); DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss"); DateTime dt = formatter.parseDateTime(dt1);
source share