C# Класс Cliver.DateTimeRoutines

Miscellaneous and parsing methods for DateTime
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
DefaultDateIsNow bool

Открытые методы

Метод Описание
GetSecondsSinceUnixEpoch ( this date_time ) : uint

Amount of seconds elapsed between 1970-01-01 00:00:00 and the date-time.

TryParseDate ( this str, DateTimeFormat default_format, System.DateTime &date ) : bool

Tries to find date within the passed string and return it as DateTime structure. It recognizes only date while ignoring time, so time in the returned DateTime is always 0:0:0. If year of the date was not found then it accepts the current year.

TryParseDate ( this str, DateTimeFormat default_format, ParsedDateTime &parsed_date ) : bool

Tries to find date within the passed string and return it as ParsedDateTime object. It recognizes only date while ignoring time, so time in the returned ParsedDateTime is always 0:0:0. If year of the date was not found then it accepts the current year.

TryParseDateOrTime ( this str, DateTimeFormat default_format, System.DateTime &date_time ) : bool

Tries to find date and/or time within the passed string and return it as DateTime structure. If only date was found, time in the returned DateTime is always 0:0:0. If only time was found, date in the returned DateTime is DefaultDate.

TryParseDateOrTime ( this str, DateTimeFormat default_format, ParsedDateTime &parsed_date_time ) : bool

Tries to find date and/or time within the passed string and return it as ParsedDateTime object. If only date was found, time in the returned ParsedDateTime is always 0:0:0. If only time was found, date in the returned ParsedDateTime is DefaultDate.

TryParseDateTime ( this str, DateTimeFormat default_format, System.DateTime &date_time ) : bool

Tries to find date and time within the passed string and return it as DateTime structure.

TryParseDateTime ( this str, DateTimeFormat default_format, ParsedDateTime &parsed_date_time ) : bool

Tries to find date and time within the passed string and return it as ParsedDateTime object.

TryParseTime ( this str, DateTimeFormat default_format, System.DateTime &time ) : bool

Tries to find time within the passed string and return it as DateTime structure. It recognizes only time while ignoring date, so date in the returned DateTime is always 1/1/1.

TryParseTime ( this str, DateTimeFormat default_format, ParsedDateTime &parsed_time ) : bool

Tries to find time within the passed string and return it as ParsedDateTime object. It recognizes only time while ignoring date, so date in the returned ParsedDateTime is always 1/1/1

TryParseTime ( this str, DateTimeFormat default_format, ParsedDateTime &parsed_time, ParsedDateTime parsed_date ) : bool

Tries to find time within the passed string (relatively to the passed parsed_date if any) and return it as ParsedDateTime object. It recognizes only time while ignoring date, so date in the returned ParsedDateTime is always 1/1/1

Приватные методы

Метод Описание
convert_to_date ( int year, int month, int day, System.DateTime &date ) : bool

Описание методов

GetSecondsSinceUnixEpoch() публичный статический Метод

Amount of seconds elapsed between 1970-01-01 00:00:00 and the date-time.
public static GetSecondsSinceUnixEpoch ( this date_time ) : uint
date_time this date-time
Результат uint

TryParseDate() публичный статический Метод

Tries to find date within the passed string and return it as DateTime structure. It recognizes only date while ignoring time, so time in the returned DateTime is always 0:0:0. If year of the date was not found then it accepts the current year.
public static TryParseDate ( this str, DateTimeFormat default_format, System.DateTime &date ) : bool
str this string that contains date
default_format System.DateTimeFormat format to be used preferably in ambivalent instances
date System.DateTime parsed date output
Результат bool

TryParseDate() публичный статический Метод

Tries to find date within the passed string and return it as ParsedDateTime object. It recognizes only date while ignoring time, so time in the returned ParsedDateTime is always 0:0:0. If year of the date was not found then it accepts the current year.
public static TryParseDate ( this str, DateTimeFormat default_format, ParsedDateTime &parsed_date ) : bool
str this string that contains date
default_format System.DateTimeFormat format to be used preferably in ambivalent instances
parsed_date ParsedDateTime parsed date output
Результат bool

TryParseDateOrTime() публичный статический Метод

Tries to find date and/or time within the passed string and return it as DateTime structure. If only date was found, time in the returned DateTime is always 0:0:0. If only time was found, date in the returned DateTime is DefaultDate.
public static TryParseDateOrTime ( this str, DateTimeFormat default_format, System.DateTime &date_time ) : bool
str this string that contains date and(or) time
default_format System.DateTimeFormat format to be used preferably in ambivalent instances
date_time System.DateTime parsed date-time output
Результат bool

TryParseDateOrTime() публичный статический Метод

Tries to find date and/or time within the passed string and return it as ParsedDateTime object. If only date was found, time in the returned ParsedDateTime is always 0:0:0. If only time was found, date in the returned ParsedDateTime is DefaultDate.
public static TryParseDateOrTime ( this str, DateTimeFormat default_format, ParsedDateTime &parsed_date_time ) : bool
str this string that contains date-time
default_format System.DateTimeFormat format to be used preferably in ambivalent instances
parsed_date_time ParsedDateTime parsed date-time output
Результат bool

TryParseDateTime() публичный статический Метод

Tries to find date and time within the passed string and return it as DateTime structure.
public static TryParseDateTime ( this str, DateTimeFormat default_format, System.DateTime &date_time ) : bool
str this string that contains date and/or time
default_format System.DateTimeFormat format to be used preferably in ambivalent instances
date_time System.DateTime parsed date-time output
Результат bool

TryParseDateTime() публичный статический Метод

Tries to find date and time within the passed string and return it as ParsedDateTime object.
public static TryParseDateTime ( this str, DateTimeFormat default_format, ParsedDateTime &parsed_date_time ) : bool
str this string that contains date-time
default_format System.DateTimeFormat format to be used preferably in ambivalent instances
parsed_date_time ParsedDateTime parsed date-time output
Результат bool

TryParseTime() публичный статический Метод

Tries to find time within the passed string and return it as DateTime structure. It recognizes only time while ignoring date, so date in the returned DateTime is always 1/1/1.
public static TryParseTime ( this str, DateTimeFormat default_format, System.DateTime &time ) : bool
str this string that contains time
default_format System.DateTimeFormat format to be used preferably in ambivalent instances
time System.DateTime parsed time output
Результат bool

TryParseTime() публичный статический Метод

Tries to find time within the passed string and return it as ParsedDateTime object. It recognizes only time while ignoring date, so date in the returned ParsedDateTime is always 1/1/1
public static TryParseTime ( this str, DateTimeFormat default_format, ParsedDateTime &parsed_time ) : bool
str this string that contains date-time
default_format System.DateTimeFormat format to be used preferably in ambivalent instances
parsed_time ParsedDateTime parsed date-time output
Результат bool

TryParseTime() публичный статический Метод

Tries to find time within the passed string (relatively to the passed parsed_date if any) and return it as ParsedDateTime object. It recognizes only time while ignoring date, so date in the returned ParsedDateTime is always 1/1/1
public static TryParseTime ( this str, DateTimeFormat default_format, ParsedDateTime &parsed_time, ParsedDateTime parsed_date ) : bool
str this string that contains date
default_format System.DateTimeFormat format to be used preferably in ambivalent instances
parsed_time ParsedDateTime parsed date-time output
parsed_date ParsedDateTime ParsedDateTime object if the date was found within this string, else NULL
Результат bool

Описание свойств

DefaultDateIsNow публичное статическое свойство

If true then DefaultDate property is ignored and DefaultDate is always DateTime.Now
public static bool DefaultDateIsNow
Результат bool