Class DateHelper
Date helper.
Inherited Members
Namespace: EduCATS.Helpers.Date
Assembly: EduCATS.dll
Syntax
public static class DateHelper
Fields
DateTime
Date string.
Declaration
public const string DateTime = "dd.MM.yyyy"
Field Value
Type | Description |
---|---|
string |
DefaultDateTime
Default date string.
Declaration
public const string DefaultDateTime = "0001-01-01"
Field Value
Type | Description |
---|---|
string |
DefaultDateTimeFormat
Declaration
public const string DefaultDateTimeFormat = "dd-MM-yyyy HH:mm"
Field Value
Type | Description |
---|---|
string |
Methods
CheckDatesDifference(DateTime, DateTime)
Get dates difference in TimeSpan.
Declaration
public static TimeSpan CheckDatesDifference(DateTime startDate, DateTime endDate)
Parameters
Type | Name | Description |
---|---|---|
DateTime | startDate | Start date. |
DateTime | endDate | End date. |
Returns
Type | Description |
---|---|
TimeSpan | Time difference. |
Convert13DigitsUnixToDateTime(double)
Convert 13-digits unix to DateTime.
Declaration
public static DateTime Convert13DigitsUnixToDateTime(double unixTimestamp)
Parameters
Type | Name | Description |
---|---|---|
double | unixTimestamp | 13-digits unix timestamp. |
Returns
Type | Description |
---|---|
DateTime | Converted DateTime. |
GetDaysWithFirstLetters()
Get list of days' first letters.
Declaration
public static List<string> GetDaysWithFirstLetters()
Returns
Type | Description |
---|---|
List<string> | List of days' first letters. |
GetMonthName(int)
Gete month name by number.
Declaration
public static string GetMonthName(int month)
Parameters
Type | Name | Description |
---|---|---|
int | month | Month number. |
Returns
Type | Description |
---|---|
string | Month name. |
GetUnixFromString(string)
Parse string for unix numbers.
Declaration
public static double GetUnixFromString(string unixDateString)
Parameters
Type | Name | Description |
---|---|---|
string | unixDateString | Unix date string
in " |
Returns
Type | Description |
---|---|
double | Unix date. |
GetWeekDays(DateTime)
Get weeks days by date.
Declaration
public static List<DateTime> GetWeekDays(DateTime date)
Parameters
Type | Name | Description |
---|---|---|
DateTime | date | Date. |
Returns
Type | Description |
---|---|
List<DateTime> | Week days. |
GetWeekStartDate(DateTime, WeekEnum)
Get start of week date.
Declaration
public static DateTime GetWeekStartDate(DateTime currentDate, WeekEnum week)
Parameters
Type | Name | Description |
---|---|---|
DateTime | currentDate | Current date. |
WeekEnum | week | Week enumeration. |
Returns
Type | Description |
---|---|
DateTime | Week start date. |