EssentialsTime.TryParse method
Namespace | Skybrud.Essentials.Time |
---|---|
Assembly | Skybrud.Essentials.dll |
TryParse(string, out EssentialsTime)
Converts the specified string representation of a date and time to its EssentialsTime equivalent and returns a value that indicates whether the conversion succeeded.
public static bool TryParse(string str, EssentialsTime result)
Parameters
str
String
A string containing a date and time to convert.
result
EssentialsTime
When this method returns, contains the EssentialsTime value
equivalent to the date and time contained in str
, if the conversion succeeded, or
null
if the conversion failed. The conversion fails if the str
parameter is
null
, is an empty string (""), or does not contain a valid string representation of a date and
time. This parameter is passed uninitialized.
Returns
true
if the str
parameter was converted successfully; otherwise, false
.
TryParse(string, IFormatProvider, DateTimeStyles, out EssentialsTime)
Tries to convert a specified string representation of a date and time to its EssentialsTime equivalent, and returns a value that indicates whether the conversion succeeded.
public static bool TryParse(string input, IFormatProvider provider, DateTimeStyles styles, EssentialsTime result)
Parameters
input
String
A string that contains a date and time to convert.
provider
IFormatProvider
An object that provides culture-specific formatting information about input.
styles
DateTimeStyles
A bitwise combination of enumeration values that indicates the permitted format of input.
result
EssentialsTime
When the method returns, contains the EssentialsTime value equivalent to
the date and time of input, if the conversion succeeded, or null
, if the conversion failed. The
conversion fails if the input parameter is null or does not contain a valid string representation of a date
and time. This parameter is passed uninitialized.
Returns
true
if the input parameter is successfully converted; otherwise, false
.