Date nowTime = new Date(); SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String now = time.format(nowTime);