我有一个字符串,看起来像这样:
"2013/1/16"
有没有办法在JavaScript中快速将其转换为日期对象,例如:
convertToDateTime("2013/1/16", "yyyy/MM/dd")
我有一个字符串,看起来像这样:
"2013/1/16"
convertToDateTime("2013/1/16", "yyyy/MM/dd")
new Date("12-01-2019")
,结果返回 Sun Dec 01 2019 00:00:00 GMT+0530 (India Standard Time)
。如果我想让日期对象表示1月12日而不是12月1日怎么办? - Abhivar myDate = new Date("2013/1/16");
var str = "2013/1/16"; var strToDate = new Date(str);
var myDate = new Date("2013/1/16");
var str = "2013/1/16"; var strToDate = new Date(str);