< ;meta http-equiv="Content-Type" content="textml; charset=utf-8">
js acquisition date: the day before yesterday, yesterday, today, tomorrow, the day after tomorrow - Liehuo.Net title>
One of the methods is: Date.parse(dateVal). This function is powerful, but it has a fatal shortcoming, that is, it does not support our commonly used "year-month- "Day" format, short dates can use "/" or "-" as the date separator, but must be expressed in month/day/year format, such as "7/20/96".
Another method is to use split, such as:
var dtStr = "2006-11-25";
var dtArr = dtStr.split("-");
var dt = new Date(dtArr[0], dtArr[1], dtArr [2]);
However, this method is relatively rigid and requires a fixed date format. It should only be used when there is no other way.
If we can separate the year, month and day, we should try to separate them. For example, ASP outputs the year, month and day separately. Then use new Date to process it, and the date type will be returned.
Date formatting