C# Class Argentini.Halide.H3Temporal

The H3Temporal class contains methods and properties for manipulating, evaluating, or displaying dates and times.
Datei anzeigen Open project: argentini/Halide Class Usage Examples

Public Methods

Method Description
CalculateAge ( System.DateTime birthday ) : Int32

Calculate an age with a given birthdate. Assumes current timezone.

CalculateAge ( System.DateTime birthday, int utcOffset ) : Int32

Calculate an age with a given birthdate.

ConvertDateToTimeZone ( System.DateTime dateTime, String timeZoneText ) : System.DateTime

Convert a DateTime value to a given time zone, automatically handling DST if using .NET CLR 3.5 or later.

DateDiff ( DateDiffComparisonType howtocompare, System startDate, System endDate ) : Double

Compares 2 dates and determine the time interval between them.

DateDiff ( DateDiffComparisonType howtocompare, System startDate, int startDateOffset, System endDate, int endDateOffset ) : Double

Compares 2 dates and determine the time interval between them taking time zones into account.

DateFormat ( System date, DateFormats format ) : String

Format a date/time variable for output.

DateFormat ( string date, DateFormats format ) : String

Format a date/time variable for output.

DateRange ( DateRangeOptions dateRangeOptions, System.DateTime relativeDate ) : DateRangeStruct

Returns a string array with start and end dates for a given range.

DateRange ( DateRangeOptions dateRangeOptions, string relativeDate ) : DateRangeStruct

Returns a string array with start and end dates for a given range.

GetMonthName ( Int32 monthNumber, System.Boolean returnAbbreviation ) : String

Get the month name by its number.

GetMonthName ( String monthNumber, System.Boolean returnAbbreviation ) : String

Get the month name by its number.

GetWeekRange ( System.DateTime date ) : System.Int32[]

Get the start and end day of a week range for a given date withina month.

TimeFormat ( System date, TimeFormats format ) : String

Format a time of day for output.

TimeFormat ( string date, TimeFormats format ) : String

Format a time of day for output.

Today ( ) : String

Return the current date as a string using slashes as delimitters (e.g. 12/31/2009).

Today ( H3Temporal format ) : String

Return the current date as a string.

Private Methods

Method Description
FormatAbstract ( double value, string increment, double lowend, double halfway, double almost, bool future ) : String

Used to render abstract dates.

H3Temporal ( ) : System

Method Details

CalculateAge() public static method

Calculate an age with a given birthdate. Assumes current timezone.
public static CalculateAge ( System.DateTime birthday ) : Int32
birthday System.DateTime A value representing a birthday./>
return System.Int32

CalculateAge() public static method

Calculate an age with a given birthdate.
public static CalculateAge ( System.DateTime birthday, int utcOffset ) : Int32
birthday System.DateTime A value representing a birthday./>
utcOffset int An value indicating the offset to apply to UTC.
return System.Int32

ConvertDateToTimeZone() public static method

Convert a DateTime value to a given time zone, automatically handling DST if using .NET CLR 3.5 or later.
public static ConvertDateToTimeZone ( System.DateTime dateTime, String timeZoneText ) : System.DateTime
dateTime System.DateTime DateTime value to convert.
timeZoneText String Text value of the desired time zone. Examples include "Eastern Standard Time", "Central Standard Time", "Mountain Standard Time", "Pacific Standard Time".
return System.DateTime

DateDiff() public static method

Compares 2 dates and determine the time interval between them.
public static DateDiff ( DateDiffComparisonType howtocompare, System startDate, System endDate ) : Double
howtocompare DateDiffComparisonType String specifying comparison type.
startDate System First date for comparison. If earlier than endDate, a positive result is returned.
endDate System Last date for comparison. If later than startDate, a positive result is returned.
return Double

DateDiff() public static method

Compares 2 dates and determine the time interval between them taking time zones into account.
public static DateDiff ( DateDiffComparisonType howtocompare, System startDate, int startDateOffset, System endDate, int endDateOffset ) : Double
howtocompare DateDiffComparisonType String specifying compare type
startDate System First date for comparison. If earlier than endDate, a positive result is returned.
startDateOffset int UTC offset value for startDate datetime.
endDate System Last date for comparison. If later than startDate, a positive result is returned.
endDateOffset int UTC offset value for endDate datetime.
return Double

DateFormat() public static method

Format a date/time variable for output.
public static DateFormat ( System date, DateFormats format ) : String
date System DateTime variable to format.
format DateFormats Date format.
return String

DateFormat() public static method

Format a date/time variable for output.
public static DateFormat ( string date, DateFormats format ) : String
date string DateTime variable to format.
format DateFormats Date format.
return String

DateRange() public static method

Returns a string array with start and end dates for a given range.
public static DateRange ( DateRangeOptions dateRangeOptions, System.DateTime relativeDate ) : DateRangeStruct
dateRangeOptions DateRangeOptions Enumeration value specifying which abstracted date range to evaluate. Note, weeks begin on Sunday and end on Saturday.
relativeDate System.DateTime Date to use as the basis for calculating the start and end date of the range.
return DateRangeStruct

DateRange() public static method

Returns a string array with start and end dates for a given range.
public static DateRange ( DateRangeOptions dateRangeOptions, string relativeDate ) : DateRangeStruct
dateRangeOptions DateRangeOptions Enumeration value specifying which abstracted date range to evaluate. Note, weeks begin on Sunday and end on Saturday.
relativeDate string Date to use as the basis for calculating the start and end date of the range.
return DateRangeStruct

GetMonthName() public static method

Get the month name by its number.
public static GetMonthName ( Int32 monthNumber, System.Boolean returnAbbreviation ) : String
monthNumber System.Int32 Month number for which a name is requested (1 to 12).
returnAbbreviation System.Boolean Set to "true" to return month names abbreviation (e.g. Dec).
return String

GetMonthName() public static method

Get the month name by its number.
public static GetMonthName ( String monthNumber, System.Boolean returnAbbreviation ) : String
monthNumber String Month number for which a name is requested (1 to 12).
returnAbbreviation System.Boolean Set to "true" to return month names abbreviation (e.g. Dec).
return String

GetWeekRange() public static method

Get the start and end day of a week range for a given date withina month.
public static GetWeekRange ( System.DateTime date ) : System.Int32[]
date System.DateTime Date for which you'd like the week day range.
return System.Int32[]

TimeFormat() public static method

Format a time of day for output.
public static TimeFormat ( System date, TimeFormats format ) : String
date System Time variable to format.
format TimeFormats Time format.
return String

TimeFormat() public static method

Format a time of day for output.
public static TimeFormat ( string date, TimeFormats format ) : String
date string Time variable to format.
format TimeFormats Time format.
return String

Today() public static method

Return the current date as a string using slashes as delimitters (e.g. 12/31/2009).
public static Today ( ) : String
return String

Today() public static method

Return the current date as a string.
public static Today ( H3Temporal format ) : String
format H3Temporal H3Temporal.DateFormats value for formatting the date.
return String