EssentialsDateTime.TryParse method

Version 1.1.28
.NET Framework 4.8
Namespace Skybrud.Essentials.Time
Assembly Skybrud.Essentials.dll

TryParse(string, out EssentialsDateTime)

Static

Converts the specified string representation of a date and time to its EssentialsDateTime equivalent and returns a value that indicates whether the conversion succeeded.

public static bool TryParse(string str, EssentialsDateTime result)

Parameters

str String

A string containing a date and time to convert.

When this method returns, contains the EssentialsDateTime 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 EssentialsDateTime)

Static

Converts the specified string representation of a date and time to its EssentialsDateTime equivalent using the specified culture-specific format information and formatting style, and returns a value that indicates whether the conversion succeeded.

public static bool TryParse(string str, IFormatProvider provider, DateTimeStyles styles, EssentialsDateTime result)

Parameters

str String

A string containing a date and time to convert.

provider IFormatProvider

An object that supplies culture-specific formatting information about str.

A bitwise combination of enumeration values that defines how to interpret the parsed date in relation to the current time zone or the current date. A typical value to specify is System.Globalization.DateTimeStyles.None.

When this method returns, contains the EssentialsDateTime 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.