EAPConvertParseDateTime Method (String, String, CultureInfo, DateTime) |
Converts the specified string representation of a date and time to its DateTime equivalent
using the specified culture-specific format information. Note that if time is provide without
a date specification, then the date will be defaulted to 1899-12-30 (the COM time-only date).
Note also that internal whitespace is ignored.
Internally both DateTime.TryParseExact() and DateTime.TryParse() are used to provide wider
conversion coverage. This is particularly important for time-only values.
Namespace:
NetQuarry
Assembly:
EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax public static DateTime ParseDateTime(
string s,
string format,
CultureInfo culture,
DateTime date
)
Public Shared Function ParseDateTime (
s As String,
format As String,
culture As CultureInfo,
date As DateTime
) As DateTime
Parameters
- s
- Type: SystemString
The date/time string to parse. - format
- Type: SystemString
The optional date/time format specification. - culture
- Type: System.GlobalizationCultureInfo
The optional culture for which to parse. - date
- Type: SystemDateTime
The date to use when a time-only value is parsed.
Return Value
Type:
DateTime
The DateTime value if successfully converted, else a FormatException is thrown.
Note that blank strings are successfully converted to DateTime.MinValue.
See Also