function DateDiff(asStartDate,asEndDate){
var miStart=Date.parse(asStartDate.replace(/\-/g,'/'));
var miEnd=Date.parse(asEndDate.replace(/\-/g,'/'));
return (miEnd-miStart)/(1000*24*3600);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
parse
Returns the number of milliseconds in a date string since January 1, 1970, 00:00:00, local time.
方法源 Date
静态
实现版本 Navigator 2.0, LiveWire 1.0
语法
Date.parse(dateString)
参数
:
dateString A string representing a date.
描述
The parse method takes a date string (such as "Dec 25, 1995") and returns the number of milliseconds since January 1, 1970, 00:00:00 (local time). This function is useful for setting date values based on string values, for example in conjunction with the setTime method and the Date object.
Given a string representing a time, parse returns the time value. It accepts the IETF standard date语法: "Mon, 25 Dec 1995 13:30:00 GMT". It understands the continental US time-zone abbreviations, but for general use, use a time-zone offset, for example, "Mon, 25 Dec 1995 13:30:00 GMT+0430" (4 hours, 30 minutes west of the Greenwich meridian). If you do not specify a time zone, the local time zone is assumed. GMT and UTC are considered equivalent.
Because parse is a static method of Date, you always use it as Date.parse(), rather than as a method of a Date object you created.
示例
If IPOdate is an existing Date object, then you can set it to August 9, 1995 as follows:
IPOdate.setTime(Date.parse("Aug 9, 1995"))
var miStart=Date.parse(asStartDate.replace(/\-/g,'/'));
var miEnd=Date.parse(asEndDate.replace(/\-/g,'/'));
return (miEnd-miStart)/(1000*24*3600);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
parse
Returns the number of milliseconds in a date string since January 1, 1970, 00:00:00, local time.
方法源 Date
静态
实现版本 Navigator 2.0, LiveWire 1.0
语法
Date.parse(dateString)
参数
:
dateString A string representing a date.
描述
The parse method takes a date string (such as "Dec 25, 1995") and returns the number of milliseconds since January 1, 1970, 00:00:00 (local time). This function is useful for setting date values based on string values, for example in conjunction with the setTime method and the Date object.
Given a string representing a time, parse returns the time value. It accepts the IETF standard date语法: "Mon, 25 Dec 1995 13:30:00 GMT". It understands the continental US time-zone abbreviations, but for general use, use a time-zone offset, for example, "Mon, 25 Dec 1995 13:30:00 GMT+0430" (4 hours, 30 minutes west of the Greenwich meridian). If you do not specify a time zone, the local time zone is assumed. GMT and UTC are considered equivalent.
Because parse is a static method of Date, you always use it as Date.parse(), rather than as a method of a Date object you created.
示例
If IPOdate is an existing Date object, then you can set it to August 9, 1995 as follows:
IPOdate.setTime(Date.parse("Aug 9, 1995"))