Class DTHelperCs
- Namespace
- SunamoDateTime.DT
- Assembly
- SunamoDateTime.dll
Provides Czech-localized DateTime formatting, parsing and age calculation methods.
public class DTHelperCs
- Inheritance
-
DTHelperCs
- Inherited Members
- Extension Methods
Methods
AppendToFrontOnlyTime(string)
Return actual time(for example 12:00:00:000) and after that A1 postfix
public static string AppendToFrontOnlyTime(string postfix)
Parameters
postfixstring
Returns
CalculateAgeAndAddRightString(DateTime, bool, DateTime)
Calculates age from a date and returns it as a Czech localized string with nominative case. Returns empty string when dateTime equals dtMinVal.
public static string CalculateAgeAndAddRightString(DateTime dateTime, bool calculateTime, DateTime dtMinVal = default)
Parameters
dateTimeDateTimeThe birth/start date
calculateTimeboolWhether to include time units (hours, minutes, seconds) when age is less than 1 day
dtMinValDateTimeThe minimum DateTime value representing an unset date
Returns
CalculateAgeAndAddRightStringKymCim(DateTime, bool, LangsDt, DateTime)
Calculates age from a date and returns it as a Czech localized string with instrumental case (kym/cim).
public static string CalculateAgeAndAddRightStringKymCim(DateTime dateTime, bool calculateTime, LangsDt lang, DateTime dtMinVal)
Parameters
dateTimeDateTimeThe birth/start date
calculateTimeboolWhether to include time units (hours, minutes, seconds)
langLangsDtThe language for localization (must be Czech)
dtMinValDateTimeThe minimum DateTime value representing an unset date
Returns
DateTimeToStringWithDayOfWeekCS(DateTime)
Wednesday, 21.6.1989 11:22 (dont fill with zero)
public static string DateTimeToStringWithDayOfWeekCS(DateTime dateTime)
Parameters
dateTimeDateTime
Returns
DateToStringWithDayOfWeekCS(DateTime)
Středa, 21.6.1989
public static string DateToStringWithDayOfWeekCS(DateTime dateTime)
Parameters
dateTimeDateTime
Returns
DayOfWeek2DenVTydnu(DayOfWeek)
public static string DayOfWeek2DenVTydnu(DayOfWeek dayOfWeek)
Parameters
dayOfWeekDayOfWeek
Returns
IntervalToString(DateTime, DateTime, LangsDt, DateTime)
Formats a date-time interval as a localized string (e.g. "21.6.1989 11:22-22.6.1989 14:00").
public static string IntervalToString(DateTime startDateTime, DateTime endDateTime, LangsDt lang, DateTime dtMinVal)
Parameters
startDateTimeDateTimeThe start of the interval
endDateTimeDateTimeThe end of the interval
langLangsDtThe language for localization
dtMinValDateTimeThe minimum DateTime value representing an unset date
Returns
- string
Formatted interval string
ParseDateCzech(string)
21.6.1989. DateTime.MinValue when cannot be parsed
public static DateTime ParseDateCzech(string text)
Parameters
textstring
Returns
ParseDateTimeCzech(string)
Parses a Czech-formatted date-time string using the Czech culture info.
public static DateTime ParseDateTimeCzech(string text)
Parameters
textstringThe Czech date-time string to parse
Returns
- DateTime
Parsed DateTime
ParseTimeCzech(string)
hh:mm:ss If fail, return DT.MinValue Seconds can be omit
public static DateTime ParseTimeCzech(string text)
Parameters
textstring
Returns
ToShortDate(DateTime)
21.6.1989
public static string ToShortDate(DateTime dateTime)
Parameters
dateTimeDateTimeDateTime to convert
Returns
ToShortTime(DateTime, bool)
11:22 Without seconds
public static string ToShortTime(DateTime dateTime, bool fillUpByZeros = false)
Parameters
Returns
ToShortTimeFromSeconds(long)
11:22 dont fill up with zero
public static string ToShortTimeFromSeconds(long from)
Parameters
fromlong
Returns
ToShortTimeWithSecond(DateTime, bool)
With seconds 11:22:00 (depends on A2)
public static string ToShortTimeWithSecond(DateTime dateTime, bool fillUpByZeros = false)
Parameters
Returns
ToTimeAgo(DateTime)
Returns a Czech "time ago" string describing how long ago the past date was relative to now.
public static string ToTimeAgo(DateTime pastDate)
Parameters
pastDateDateTimeThe past date to compare
Returns
- string
Czech localized "time ago" string
ToTimeAgo(DateTime, DateTime)
Returns a Czech "time ago" string describing how long ago the past date was relative to the current date.
public static string ToTimeAgo(DateTime pastDate, DateTime currentDate)
Parameters
Returns
- string
Czech localized "time ago" string