/******************************************************************
* 日期检查
* ******************************************************************/
public static bool checkDate(string DateStr)
{
try
{
char[] split = new char[1];
split[0] = '-';
string[] s = DateStr.Split(split,3);
int y = Convert.ToInt32(s[0]);
int m = Convert.ToInt32(s[1]);
int d = Convert.ToInt32(s[2]);
DateTime dt = new DateTime(y,m,d);
if(dt.Year==y&&dt.Month==m&&dt.Day==d) return true;
return false;
}
catch{return false;}
}
请问参数有什么格式要求吗?还有下面的:
public static DateTime getDateTime(string DateStr)
{
try
{
char[] split = new char[1];
split[0] = '-';
string[] s = DateStr.Split(split,3);
int y = Convert.ToInt32(s[0]);
int m = Convert.ToInt32(s[1]);
int d = Convert.ToInt32(s[2]);
return new DateTime(y,m,d);
}
catch{return DateTime.Now;}
}
* 日期检查
* ******************************************************************/
public static bool checkDate(string DateStr)
{
try
{
char[] split = new char[1];
split[0] = '-';
string[] s = DateStr.Split(split,3);
int y = Convert.ToInt32(s[0]);
int m = Convert.ToInt32(s[1]);
int d = Convert.ToInt32(s[2]);
DateTime dt = new DateTime(y,m,d);
if(dt.Year==y&&dt.Month==m&&dt.Day==d) return true;
return false;
}
catch{return false;}
}
请问参数有什么格式要求吗?还有下面的:
public static DateTime getDateTime(string DateStr)
{
try
{
char[] split = new char[1];
split[0] = '-';
string[] s = DateStr.Split(split,3);
int y = Convert.ToInt32(s[0]);
int m = Convert.ToInt32(s[1]);
int d = Convert.ToInt32(s[2]);
return new DateTime(y,m,d);
}
catch{return DateTime.Now;}
}
顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!
顶!顶! ! ! 顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶! ! 顶!顶! 顶! !顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶! 顶! 顶!顶! !顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶! ! !顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!
顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!顶!