日期格式

    xiaoxiao2023-10-13  184

    toLocaleString()函数用于以字符串的形式返回当前Date对象 Date.prototype.toLocaleString = function() { return this.getFullYear() + "-" + (this.getMonth() + 1) + "-" + this.getDate(); };

    使用 new Date().toLocaleString() 得到如下图 或者 new Date(时间戳).toLocaleString() 得到

    最新回复(0)