Convert String value to Date Value Or Min - CSharp System

CSharp examples for System:DateTime

Description

Convert String value to Date Value Or Min

Demo Code


using System.Text;
using System.IO;/*from www  .  jav  a2s .c  o  m*/
using System.Globalization;
using System.Collections.Generic;
using System;

public class Main{
        public static System.DateTime DateValueOrMin(this string value)
        {
            System.DateTime result;
            if (System.DateTime.TryParse(value, out result))
            {
                return result;
            }
            else
            {
                return DateTime.MinValue;
            }

        }
}

Related Tutorials