我是 Jquery 新手,任何人都可以帮助我或给我有关此问题的示例。 如何将日期从单词格式化为数字?前任。 2004 年 11 月 4 日至 2004 年 4 月 11 日使用 JQuery?
提前致谢..
最佳答案
var now = new Date('Nov 4, 2004');
var date = now.getDate();
var year = now.getFullYear();
var month = now.getMonth();
var date1 = date < 10 ? "0"+date : date;
console.log(month+1+"/"+date1+"/"+year)
- 月份加 1,因为它从 0 开始
关于javascript - 如何将日期从单词格式化为数字?前任。 2004 年 11 月 4 日至 11/04/2004 使用 JQuery?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37719585/