首页 新闻 会员 周边

碰见了一到面试题求大神赐教

-1
悬赏园豆:5 [已关闭问题] 关闭于 2017-05-25 10:24

最后两个答案不太懂什么意思  求大神吗讲一下

白闹的主页 白闹 | 菜鸟二级 | 园豆:260
提问于:2017-04-24 19:13
< >
分享
所有回答(1)
0

有个日期转换的例子:

Date.prototype.yyyyMMdd = function () {
var yyyy = this.getFullYear().toString();
var MM = (this.getMonth() + 1).toString()//getMonth() is zero based
var dd = this.getDate().toString();
var hh = this.getHours().toString();
var mm = this.getMinutes().toString();
var ss = this.getSeconds().toString();
return yyyy + "-" + (MM[1] ? MM : "0" + MM[0]) + "-" + (dd[1] ? dd : "0" + dd[0]) + " "
+ (hh[1] ? hh : "0" + hh[0]) + ":" + (mm[1] ? mm : "0" + mm[0]) + ":" + (ss[1] ? ss : "0" + ss[0]);
}

 

 var newDate = new Date();

  newDate.yyyyMMdd()

肖恩部落 | 园豆:585 (小虾三级) | 2017-04-25 13:28
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册