Table of Contents

Class DateTimeExtensions

Namespace
Raytha.Application.Common.Utils
Assembly
Raytha.Application.dll
public static class DateTimeExtensions
Inheritance
DateTimeExtensions
Inherited Members

Fields

DEFAULT_DATE_FORMAT

public const string DEFAULT_DATE_FORMAT = "MM/dd/yyyy"

Field Value

string

DEFAULT_TIMEZONE

public const string DEFAULT_TIMEZONE = "Etc/UTC"

Field Value

string

MM_dd_yyyy

public const string MM_dd_yyyy = "MM/dd/yyyy"

Field Value

string

dd_MM_yyyy

public const string dd_MM_yyyy = "dd/MM/yyyy"

Field Value

string

Methods

GetDateFormats()

public static IEnumerable<string> GetDateFormats()

Returns

IEnumerable<string>

GetDateFromString(string)

public static DateTime? GetDateFromString(this string dateAsString)

Parameters

dateAsString string

Returns

DateTime?

GetTimeZoneDisplayNames()

public static IDictionary<string, string> GetTimeZoneDisplayNames()

Returns

IDictionary<string, string>

GetTimeZoneInfo(string)

public static TimeZoneInfo GetTimeZoneInfo(string timeZone)

Parameters

timeZone string

Returns

TimeZoneInfo

IsValidDateFormat(string)

public static bool IsValidDateFormat(string dateFormat)

Parameters

dateFormat string

Returns

bool

IsValidTimeZone(string)

public static bool IsValidTimeZone(string timeZone)

Parameters

timeZone string

Returns

bool

TimeZoneToUtc(DateTime, string)

public static DateTime TimeZoneToUtc(this DateTime currentDate, string timeZone)

Parameters

currentDate DateTime
timeZone string

Returns

DateTime

UtcToTimeZone(DateTime, string)

public static DateTime UtcToTimeZone(this DateTime utc, string timeZone)

Parameters

utc DateTime
timeZone string

Returns

DateTime