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
Use Apache's DateUtils:
import org.apache.commons.lang.time.DateUtils; ... DateUtils.truncate(new Date(), Calendar.SECOND)