Since the java.util.Date object stores Date as 2014-01-24 17:33:47.214, but I want the Date format as 2014-01-24 17:33:47. I w
java.util.Date
2014-01-24 17:33:47.214
2014-01-24 17:33:47
Please try the following date formatter:
import java.text.*; SimpleDateFormat tmp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") System.out.println(tmp.format(date));