|
我出现这个错误!!!!代码如下:
Date.prototype.format = function(fmt) {
var me=this;
var o = {
"M+" : this.getMonth() + 1, // 月份
"d+" : this.getDate(), // 日
"h+" : this.getHours(), // 小时
"m+" : this.getMinutes(), // 分
"s+" : this.getSeconds(), // 秒
"q+" : Math.floor((this.getMonth() + 3) / 3), // 季度
"S" : this.getMilliseconds()
// 毫秒
};
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (me.getFullYear() + "").substr(4 - RegExp.$1.length));
}
for ( var k in o) {
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
}
}
return fmt;
}
function getNowDate() {
var me = this;
var date1;
justep.Baas.sendRequest({
"url" : "/action/action",
"action" : "action",
"async" : false,
"params" : {
},
"success" : function(data) {
var time1 = new Date(data.code).format("yyyy-MM-dd hh:mm:ss");
// alert(time1);
me.date1 = time1;
}
});
date1 = this.date1;
return date1;
}
取服务器 日期时间 返回给手机 安卓正常 苹果错误 愁死了!!!!!!!!!!!!!!!!求老师指点!!!!!!!我以为是 this.getFullYear()改成me.getFullYear()结果还是不行!!!
|
-
|