validator.cs

来自「教务管理系统 基于.net和sqlserver2000的教务管理系统」· CS 代码 · 共 32 行

CS
32
字号
using System;

namespace Park.Common
{
	/// <summary>
	/// Validator 的摘要说明。
	/// </summary>
	public class Validator
	{
		public static bool Validate(string y,string m,string d,out DateTime time)
		{	
			time = new DateTime(1900,1,1);
			int year  ,month , day ;
			if (y == null||y.Equals("")) return false;
			if (m == null||m.Equals("")) return false;
			if (d == null||d.Equals("")) return false;
			try
			{
				year = int.Parse(y);
				month = int.Parse(m);
				day = int.Parse(d);
				time = new DateTime(year,month,day);
			}
			catch(Exception)
			{
				return false;
			}
			return true;
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?