【发布时间】:2015-11-04 23:25:43
【问题描述】:
如何在 javascript 中将日期和时间设为 12/08/2015-1:49?我尝试了以下方法,但出现错误TypeError: now.format is not a function
var now = new Date();
now.format("dd/mm/yy-h:mm tt");
console.log(now); //TypeError: now.format is not a function
【问题讨论】:
-
是什么让你认为有
format方法? mdn docs -
@Haketo 谢谢。 This is where I got that
-
这篇文章是关于你需要下载并包含在你的项目中的依赖项
-
并且有问题的依赖修改了 Date.prototype,这通常被认为是不好的(阅读:糟糕)实践。
标签: javascript jquery