Is Date Time - CSharp System

CSharp examples for System:DateTime Parse

Description

Is Date Time

Demo Code


using System.Text.RegularExpressions;
using System.Text;
using System.Reflection;
using System.Linq;
using System.Collections.Generic;
using System;/*from  w ww.jav  a2  s  . c om*/

public class Main{
        public static bool IsDateTime(string input)
        {
            DateTime time;
            if (string.IsNullOrEmpty(input))
            {
                return false;
            }
            return DateTime.TryParse(input, out time);
        }
        public static bool IsNullOrEmpty(string value)
        {
            if (value == null)
            {
                return true;
            }

            return value.Trim().Length == 0;
        }
}

Related Tutorials