<HTML>
<Head>
<Title> date selector </title>
<SCRIPT type = "text/JavaScript">
/**
* Return date
* @ Param d the delimiter
* @ Param p the pattern of your date
* @ Author xinge (modify)
*/
String. Prototype. todate = function (X, p ){
If (x = NULL) x = "-";
If (P = NULL) P = "ymd ";
VaR A = This. Split (X );
Var y = parseint (A [P. indexof ("Y")]);
// Remember to change this next century
If (Y. tostring (). Length <= 2) y ++ = 2000;
If (isnan (y) y = new date (). getfullyear ();
VaR M = parseint (A [P. indexof ("M")])-1;
VaR d = parseint (A [P. indexof ("D")]);
If (isnan (D) d = 1;
Return new date (Y, M, d );
}
/**
* Format the date
* @ Param d the delimiter
* @ Param p the pattern of your date
* @ Author xinge (modify)
*/
Date. Prototype. format = function (style ){
VaR o = {
"M +": This. getmonth () + 1, // month
"D +": This. getdate (), // day
"H +": This. gethours (), // hour
"M +": This. getminutes (), // minute
"S +": This. getseconds (), // second
"W +": "five or six days, January 1, 1234". charat (this. getday (), // week
"Q +": Math. Floor (this. getmonth () + 3)/3), // quarter
"S": This. getmilliseconds () // millisecond
}
If (/(Y +)/. Test (style )){
Style = style. Replace (Regexp. $1,
(This. getfullyear () + ""). substr (4-Regexp. $1. Length ));
}
For (var k in O ){
If (New Regexp ("(" + K + ")"). Test (style )){
Style = style. Replace (Regexp. $1,
Regexp. $1. Length = 1? O [k]:
("00" + O [k]). substr ("" + O [k]). Length ));
}
}
Return style;
};
/**
* Calendar
* @ Param beginyear 1990
* @ Param endyear