Class DateTimeHelper
Methods to work with the DateTime.
public static class DateTimeHelper
- Inheritance
-
objectDateTimeHelper
Fields
MACRO_DATE_TODAY
Macro representing current date.
public const string MACRO_DATE_TODAY = "##TODAY##"
Field Value
- string
MACRO_TIME_NOW
Macro representing current date and time.
public const string MACRO_TIME_NOW = "##NOW##"
Field Value
- string
ZERO_TIME
Zero time constant.
public static readonly DateTime ZERO_TIME
Field Value
- DateTime
Methods
GetDayStart(DateTime)
Gets start of the day of specific date.
[Obsolete("Method is deprecated and will be removed in the next version.")]
[ObsoleteSince(29, 6)]
public static DateTime GetDayStart(DateTime date)
Parameters
date
DateTimeDate
Returns
- DateTime
GetHourStart(DateTime)
Gets current date without minutes and seconds.
[Obsolete("Method is deprecated and will be removed in the next version.")]
[ObsoleteSince(29, 6)]
public static DateTime GetHourStart(DateTime date)
Parameters
date
DateTimeDate
Returns
- DateTime
GetMonthStart(DateTime)
Gets the first day of the month from specific date.
[Obsolete("Method is deprecated and will be removed in the next version.")]
[ObsoleteSince(29, 6)]
public static DateTime GetMonthStart(DateTime date)
Parameters
date
DateTimeDate
Returns
- DateTime
GetWeekStart(DateTime, string)
Gets the date from the beginning of week.
[Obsolete("Method is deprecated and will be removed in the next version.")]
[ObsoleteSince(29, 6)]
public static DateTime GetWeekStart(DateTime date, string culture = null)
Parameters
date
DateTimeDate of week
culture
stringCulture
Returns
- DateTime
GetYearStart(DateTime)
Gets the first day of the year from specific date.
[Obsolete("Method is deprecated and will be removed in the next version.")]
[ObsoleteSince(29, 6)]
public static DateTime GetYearStart(DateTime date)
Parameters
date
DateTimeDate
Returns
- DateTime
IsNowOrToday(string)
Returns true, if the given value is ##NOW## or ##TODAY## macro
public static bool IsNowOrToday(string value)
Parameters
value
stringValue to check
Returns
- bool