将数字日期转换为字符串日期

时间:2015-07-15 05:47:21

标签: javascript jquery

有谁知道如何将数字日期转换为字符串日期? (参见下文)

2015-07-03 = July 03, 2015 where July is 07 (month), 03 (day), 2015 (year)

非常感谢任何帮助,建议,想法,线索,推荐。

2 个答案:

答案 0 :(得分:0)

您可以使用名为toDateString()的函数将日期转换为字符串。

以下是示例链接:

http://jsfiddle.net/naveenravi/wow1tmbg/

答案 1 :(得分:0)

要以此格式提取日期,您可以使用代码

var objDate = new Date("2015-07-03"),
    locale = "en-us",
    month = objDate.toLocaleString(locale, { month: "long"});
    year = objDate.getFullYear();
    day = objDate.getDate();
console.log(month+',' + day + " " + year);
相关问题