我想将数据绑定(bind)在 dd-mm-yy
中我正在使用的格式 json
绑定(bind)。目前我得到的日期为 2014-06-18T00:00:00
我想要dd-mm-yy
格式。请让我知道如何做到这一点。
下面是我的代码。
if (getJSONValue.LAUNCH_DATE != "" || getJSONValue.LAUNCH_DATE == null) {
$('#txtLaunchDate').val(getJSONValue.LAUNCH_DATE);
}
我的getJSONValue.LAUNCH_DATE
=2014-06-18T00:00:00
最佳答案
查看代码片段
var newDate = new Date("2014-06-18T00:00:00");
var day = newDate.getDate();
var month = newDate.getUTCMonth() + 1;
var year = newDate.getFullYear();
console.log(day + "-" + ("0" + (month)) + "-" + year );
关于javascript - 使用javascript将json字符串转换为dd-mm-yy格式的日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47223821/