DateTimeExtensions Class
Provides extension methods for the type DateTime.
public static class DateTimeExtensions
- Inheritance:
- object object
Methods
IsToday(DateTime)
Returns whether the specified DateTime is today.
public static bool IsToday(this DateTime dateTime)
Parameter | Type | Description |
---|---|---|
dateTime | DateTime | The DateTime to examine. |
Returns
IsWeekend(DateTime)
Returns whether the specified DateTime is on a weekend.
public static bool IsWeekend(this DateTime dateTime)
Parameter | Type | Description |
---|---|---|
dateTime | DateTime | The DateTime to examine. |
Returns
ToString(DateTime, DateTimeFormatPattern)
Converts the value of a DateTime object to its equivalent string representation using the specified pattern.
public static string ToString(this DateTime dateTime, DateTimeFormatPattern pattern)
Parameter | Type | Description |
---|---|---|
dateTime | DateTime | The DateTime to convert. |
pattern | DateTimeFormatPattern | A DateTimeFormatPattern specifying the conversion pattern to use. |
Returns
ToString(DateTime, DateTimeFormatPattern, IFormatProvider)
Converts the value of a DateTime object to its equivalent string representation using the specified pattern and culture-specific format information.
public static string ToString(this DateTime dateTime, DateTimeFormatPattern pattern, IFormatProvider provider)
Parameter | Type | Description |
---|---|---|
dateTime | DateTime | The DateTime to convert. |
pattern | DateTimeFormatPattern | A DateTimeFormatPattern specifying the conversion pattern to use. |
provider | IFormatProvider | An IFormatProvider that supplies culture-specific formatting information. |