Code format date bị sai

em nhập vào starDate và toDate nhưng khi chạy nó lại thành 2019-03-30 hết…

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY/mm/dd");

image

if (startDate != null) {
		strFromDate = simpleDateFormat.format(startDate);
	}
	if (toDate != null) {
		strToDate = simpleDateFormat.format(toDate);
	} 

image

SET @sqlCriterial = CONCAT(@sqlCriterial,' and DATE_FORMAT(orders.ORDER_DATE,"%Y/%m/%d") >= DATE_FORMAT(str_to_date(CONCAT("', startDate ,'"," 00:00:00"),"%d/%m/%Y %H:%i:%s"), "%Y/%m/%d")');

mm là phút nha bạn phải là

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY/MM/dd");
2 Likes

em cảm ơn… lỗi trong câu sql

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?