function TimeCtrl()
{
this.DateObj = new Date();
this.toGb = function(Str)
{
Str = Str.toString();
if(/^\d+$/.test(Str))
{
var NewStr = "";
var GBNum = "零一二三四五六七八九";
for(var i = 0; i < Str.length; i++)
{
NewStr += GBNum.charAt(Str.charAt(i).valueOf());
}
return NewStr;
}
else
{
return "";
}
}
this.GetYear = function (Format)
{
var Year = this.DateObj.getFullYear().toString();
Format = Format.toString();
if(Format == "yy")
{
return Year.substr(2);
}
else if(Format == "YY")
{
return this.toGb(Year.substr(2));
}
else if(Format == "YYYY")
{
return this.toGb(Year);
}
else
{
return Year;
}
}
this.GetMonth = function (Format)
{
var Month = (parseInt(this.DateObj.getMonth()) + 1).toString();
Format = Format.toString();
if(Format == "mm")
{
if(Month.length == 1)
{
Month = "0" + Month;
}
return Month;
}
else if(Format == "M")
{
return this.toGb(Month);
}
else if(Format == "MM")
{
if(Month.length == 1)
{
Month = "0" + M