Table of Contents

Class DateTimeFormattingExtensions

Namespace
HeroKit.DateTimes
Assembly
HeroKit.dll

Provides extension methods for DateTime values.

public static class DateTimeFormattingExtensions
Inheritance
DateTimeFormattingExtensions
Inherited Members

Methods

AsDirectoryName(DateTime, string)

Converts a DateTime to a string representation suitable for a directory name with the specified format.

public static string AsDirectoryName(this DateTime value, string format = "yyyy-MM-dd")

Parameters

value DateTime

The DateTime to format.

format string

The format string.

Returns

string

The formatted string.

AsFileName(DateTime, string)

Converts a DateTime to a string representation suitable for a file name.

public static string AsFileName(this DateTime value, string baseFileName = "")

Parameters

value DateTime

The DateTime to format.

baseFileName string

The base file name to use.

Returns

string

The formatted file name string.

ToCultureString(DateTime, CultureInfo, string)

Converts a DateTime to a string representation with the specified format and culture.

public static string ToCultureString(this DateTime value, CultureInfo culture, string format = "dd MMM yyyy, dddd")

Parameters

value DateTime

The DateTime to format.

culture CultureInfo

The format provider specifying the culture.

format string

The format string.

Returns

string

The formatted string.