在 jquery 中将 datetime 转换为 double 的最佳方法是什么?我用过 Date.parse。但是,在少数情况下这是不正确的。此外,我无法为该方法传递日期时间格式。
- 维吉
最佳答案
在 JavaScript 中,您可以简单地执行 variablename.toFixed(2);
。
例子:
var num1 = 12312.12312
console.log(num1.toFixed(2)); // Will give 12312.12
关于javascript - 在 jquery 中从日期时间获取 double 值的最佳方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16914918/