self.FormatJsonDate = function (jsonStr) {
var tmp = "";
if (jsonStr == null || jsonStr == '')
return '';
if (jsonStr != null || jsonStr != undefined)
tmp = jsonStr.toString();
var seconds = tmp.replace(/\/Date\(/, "").replace(/\)\//, "");

var now = new Date(parseInt(seconds));
return now.asString("yyyy-mm-dd hh:ii:ss");
};

//从JSON格式的日期格式化为yyyy-mm-dd
self.FormatYMD = function (jsonStr) {
var tmp = self.FormatJsonDate(jsonStr);
tmp = tmp.substr(0, 10);
return tmp;
};

//从JSON格式的日期格式化为yyyy-mm-dd hh:mm:ss
self.FromatYMDHI = function (jsonStr) {
var tmp = self.FormatJsonDate(jsonStr);
tmp = tmp.substr(0, 19);

return tmp;
};

//从JSON格式的日期格式化为yyyy-mm-dd hh:mi
self.FromatYMDHM = function (jsonStr) {
var tmp = self.FormatJsonDate(jsonStr);
tmp = tmp.substr(0, 16);

return tmp;
};

相关文章:

  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2021-10-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-27
  • 2022-01-01
  • 2022-01-01
  • 2022-12-23
  • 2022-01-01
  • 2021-11-27
相关资源
相似解决方案