TimeUtils.TryParseNumberFromMonthName method

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

TryParseNumberFromMonthName(string, out int)

Static

Converts the specified monthName into the numerical representation of the month (eg. August is the eight month of the year, and will result in 8) and returns a value that indicates whether the conversion succeeded.

public static bool TryParseNumberFromMonthName(string monthName, int result)

Parameters

monthName String

The name of the month.

result int

When this method returns, contains the int value equivalent to the month name contained in monthName, if the conversion succeeded, or 0 if the conversion failed. The conversion fails if monthName is null, is an empty string (""), or does not contain a valid month name. This parameter is passed uninitialized.

Returns

true if monthName was converted successfully; otherwise, false.

TryParseNumberFromMonthName(string, IFormatProvider, out int)

Static

Converts the specified monthName into the numerical representation of the month (eg. August is the eight month of the year, and will result in 8) and returns a value that indicates whether the conversion succeeded.

public static bool TryParseNumberFromMonthName(string monthName, IFormatProvider provider, int result)

Parameters

monthName String

The name of the month.

provider IFormatProvider

An object that supplies culture-specific format information about monthName.

result int

When this method returns, contains the int value equivalent to the month name contained in monthName, if the conversion succeeded, or 0 if the conversion failed. The conversion fails if monthName is null, is an empty string (""), or does not contain a valid month name. This parameter is passed uninitialized.

Returns

true if monthName was converted successfully; otherwise, false.