Class DateTimeUtils
- Namespace
- Common
- Assembly
- Lykke.Common.dll
public static class DateTimeUtils
- Inheritance
-
DateTimeUtils
- Inherited Members
Fields
SecondsInDay
public const int SecondsInDay = 86400
Field Value
StandartDate
public const string StandartDate = "dd/MM/yyyy"
Field Value
StandartDateTimeMask
public const string StandartDateTimeMask = "dd.MM.yy HH:mm:ss"
Field Value
Methods
FromUnixDateTime(uint)
public static DateTime FromUnixDateTime(this uint unixDateTime)
Parameters
unixDateTime
uint
Returns
GenerateDates(DateTime, DateTime)
Сгенерировать даты (без времени)
public static IEnumerable<DateTime> GenerateDates(DateTime dateFrom, DateTime dateTo)
Parameters
Returns
GenerateMonthDates(int, int)
Сгенерировать даты за определенный месяц
public static IEnumerable<DateTime> GenerateMonthDates(int year, int month)
Parameters
Returns
GetFirstWeekOfYear(DateTime)
Returns date of the first weeks' monday in that year.
public static DateTime GetFirstWeekOfYear(DateTime dt)
Parameters
dt
DateTime
Returns
GetFirstWeekOfYear(int, DateTimeKind)
Returns date of the first week's monday in the specified year.
public static DateTime GetFirstWeekOfYear(int year, DateTimeKind kind = DateTimeKind.Utc)
Parameters
year
intkind
DateTimeKind
Returns
IsIsoDateTimeString(string)
public static bool IsIsoDateTimeString(string value)
Parameters
value
string
Returns
RoundSeconds(DateTime)
[Obsolete("Use RoundToMinute(DateTime). RoundToMinute - is not misprint, RoundSeconds rounds to the minute")]
public static DateTime RoundSeconds(DateTime dateTime)
Parameters
dateTime
DateTime
Returns
RoundToHour(DateTime)
Truncates DateTime to the hours
public static DateTime RoundToHour(this DateTime dateTime)
Parameters
Returns
RoundToHour(DateTime, int)
Truncates DateTime to the hour
hours
public static DateTime RoundToHour(this DateTime dateTime, int hour)
Parameters
Returns
RoundToMinute(DateTime)
Truncates DateTime to the minutes
public static DateTime RoundToMinute(this DateTime dateTime)
Parameters
Returns
RoundToMinute(DateTime, int)
Truncates DateTime to the min
minutes
public static DateTime RoundToMinute(this DateTime dateTime, int min)
Parameters
Returns
RoundToMinutes(DateTime, int)
[Obsolete("Use RoundToMinute(DateTime, int)")]
public static DateTime RoundToMinutes(DateTime dateTime, int minInterval)
Parameters
Returns
RoundToMonth(DateTime)
Уменьшаем точность до часа - отбрасывая минуты
public static DateTime RoundToMonth(this DateTime dateTime)
Parameters
dateTime
DateTimeИсходное дата-время
Returns
- DateTime
Округленная дата-время
RoundToSecond(DateTime)
Truncates DateTime to the seconds
public static DateTime RoundToSecond(this DateTime dateTime)
Parameters
dateTime
DateTime
Returns
RoundToSecond(DateTime, int)
Truncates DateTime to the sec
seconds
public static DateTime RoundToSecond(this DateTime dateTime, int sec)
Parameters
Returns
RoundToWeek(DateTime)
Decreases date precision down to week. Shifts date to monday
public static DateTime RoundToWeek(this DateTime dateTime)
Parameters
dateTime
DateTime
Returns
RoundToYear(DateTime)
Уменьшаем точность до года - отбрасывая все остальное
public static DateTime RoundToYear(this DateTime dateTime)
Parameters
dateTime
DateTimeИсходное дата-время
Returns
- DateTime
Округленная дата-время
SetTime(DateTime, int, int, int)
public static DateTime SetTime(this DateTime src, int hours, int mins, int seconds)
Parameters
Returns
ToDateString(DateTime?)
public static string ToDateString(this DateTime? value)
Parameters
value
DateTime?
Returns
ToHtmlComponentDate(DateTime)
public static string ToHtmlComponentDate(this DateTime dateTime)
Parameters
dateTime
DateTime
Returns
ToIsoDate(DateTime)
public static string ToIsoDate(this DateTime dateTime)
Parameters
dateTime
DateTime
Returns
ToIsoDateTime(DateTime)
public static string ToIsoDateTime(this DateTime dateTime)
Parameters
dateTime
DateTime
Returns
ToTimeString(DateTime, char)
public static string ToTimeString(this DateTime dateTime, char separator = ':')
Parameters
Returns
ToUnixTime(DateTime)
public static double ToUnixTime(this DateTime dateTime)
Parameters
dateTime
DateTime
Returns
ToYyyyMmDd(DateTime)
public static string ToYyyyMmDd(this DateTime dateTime)
Parameters
dateTime
DateTime
Returns
TruncMiliseconds(DateTime)
[Obsolete("Use RoundToSecond(DateTime)")]
public static DateTime TruncMiliseconds(this DateTime dateTime)
Parameters
dateTime
DateTime
Returns
YearLastTwoDigits(int)
public static string YearLastTwoDigits(this int year)
Parameters
year
int