Table of Contents

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

postfix string

Returns

string

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

dateTime DateTime

The birth/start date

calculateTime bool

Whether to include time units (hours, minutes, seconds) when age is less than 1 day

dtMinVal DateTime

The minimum DateTime value representing an unset date

Returns

string

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

dateTime DateTime

The birth/start date

calculateTime bool

Whether to include time units (hours, minutes, seconds)

lang LangsDt

The language for localization (must be Czech)

dtMinVal DateTime

The minimum DateTime value representing an unset date

Returns

string

DateTimeToStringWithDayOfWeekCS(DateTime)

Wednesday, 21.6.1989 11:22 (dont fill with zero)

public static string DateTimeToStringWithDayOfWeekCS(DateTime dateTime)

Parameters

dateTime DateTime

Returns

string

DateToStringWithDayOfWeekCS(DateTime)

Středa, 21.6.1989

public static string DateToStringWithDayOfWeekCS(DateTime dateTime)

Parameters

dateTime DateTime

Returns

string

DayOfWeek2DenVTydnu(DayOfWeek)

public static string DayOfWeek2DenVTydnu(DayOfWeek dayOfWeek)

Parameters

dayOfWeek DayOfWeek

Returns

string

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

startDateTime DateTime

The start of the interval

endDateTime DateTime

The end of the interval

lang LangsDt

The language for localization

dtMinVal DateTime

The 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

text string

Returns

DateTime

ParseDateTimeCzech(string)

Parses a Czech-formatted date-time string using the Czech culture info.

public static DateTime ParseDateTimeCzech(string text)

Parameters

text string

The 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

text string

Returns

DateTime

ToShortDate(DateTime)

21.6.1989

public static string ToShortDate(DateTime dateTime)

Parameters

dateTime DateTime

DateTime to convert

Returns

string

ToShortTime(DateTime, bool)

11:22 Without seconds

public static string ToShortTime(DateTime dateTime, bool fillUpByZeros = false)

Parameters

dateTime DateTime
fillUpByZeros bool

Returns

string

ToShortTimeFromSeconds(long)

11:22 dont fill up with zero

public static string ToShortTimeFromSeconds(long from)

Parameters

from long

Returns

string

ToShortTimeWithSecond(DateTime, bool)

With seconds 11:22:00 (depends on A2)

public static string ToShortTimeWithSecond(DateTime dateTime, bool fillUpByZeros = false)

Parameters

dateTime DateTime
fillUpByZeros bool

Returns

string

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

pastDate DateTime

The 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

pastDate DateTime

The past date to compare

currentDate DateTime

The current/reference date

Returns

string

Czech localized "time ago" string