Is Date valid : Time Span Parse « Date Time « C# / C Sharp






Is Date valid

      

using System;
using System.Collections.Generic;
using System.Text;

public class Utils
{
    public static bool IsDateValid(string p)
    {
        try
        {
            DateTime d = DateTime.Parse(p);
            return true;
        }
        catch
        {
            return false;
        }
    }
}

   
    
    
    
    
    
  








Related examples in the same category

1.Parse string to TimeSpan
2.Parse string to TimeSpan: "18:31.05"
3.Parse string to TimeSpan: "12.035"
4.TimeSpan.Parse("0:0:3.669")
5.Parse strings to TimeSpan
6.Parse hour:minute value with "g" specifier current culture.
7.Parse hour:minute:second value with "G" specifier.
8.Parse hours:minute.second value with "G" specifier and current (en-US) culture.
9.Parse days:hours:minute.second value with "G" specifier and current (en-US) culture.
10.Parse days:hours:minute.second value with "G" specifier and fr-FR culture.
11.Parse a single number using the "c" standard format string.
12.Parse a single number using the "%h" custom format string.
13.Parse Rfc 2822 Date