System.DateTime.TryParseExact

This converts a string representation to a DateTime object. The format of the string representation must match the specified format
Returns True or False based on whether the conversion is successful


Dim sDateTimeString As String 
Dim supportedformats() As String
Dim objDateTime As System.DateTime

supportedformats = New String() {"yyyy-MM-dd", "MM/dd/yyyy"}

System.DateTime.TryParseExact(sDateTimeString, _
                                 supportedformats, _
                                 System.Globalization.CultureInfo.CurrentCulture, _
                                 System.Globalization.DateTimeStyles.None, _
                                 objDateTime)





© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext