0
문자열을 날짜로 사용하여 yyyy-MM-dd
으로 형식을 지정하고 style:"short"
으로 형식을 지정하려고합니다. 그냥 Dateformat
을 사용하고 싶습니다.날짜 형식 - 날짜 형식을 사용하여 날짜 서식을 지정하는 방법
나는이 https://openui5.hana.ondemand.com/#docs/guide/91f2eba36f4d1014b6dd926db0e91070.html을 사용하여 DateFormat
을 사용하는 방법에 대한 아이디어를 얻었습니다.
하지만 볼 수없는, 내 코드에 문제가 있는지 :
date: function(sdate) {
var regex = "[0-9]{4}-[0-9]{2}-[0-9]{2}";
if (!sdate.match(regex))
return "no valid date given";
jQuery.sap.require("sap.ui.core.format.DateFormat");
var oDateFormat = sap.ui.core.format.DateFormat.getInstance({pattern: "yyyy-MM-dd", style: "short"});
return oDateFormat.format(sdate); //date should be returned here in "short"-style
}
콘솔은 나에게 TypeError: j.getTime is not a function
있어 말한다. 또한 WebIDE가 함수 Datetime.format()
을 모르는 것처럼 보입니다.
도와 주시겠습니까?
'sdate'는'String' 객체라고 생각하지만 자바 스크립트'Date' 객체 여야합니다 – Qualiture
[Link] (https://openui5.hana.ondemand.com/#docs/guide/91f2eba36f4d1014b6dd926db0e91070). html) : 그래서이 줄에서'oField.setValue (oDateFormat.format (oDate));'oDate는 자바 스크립트'Date'Object입니까? – Michael