Time Utilities class provides date and time related routines.
Westwind.Utilities.TimeUtils
public static class TimeUtils : object
Class Members
Member | Description | |
---|---|---|
MIN_DATE_VALUE |
||
DateTimeFromDateAndTime |
Creates a DateTime value from date and time input values public static DateTime DateTimeFromDateAndTime(string Date, string Time) public static DateTime DateTimeFromDateAndTime(DateTime Date, string Time) |
|
FractionalHoursToString |
Converts a fractional hour value like 1.25 to 1:15 hours:minutes format public static string FractionalHoursToString(decimal hours, string format) public static string FractionalHoursToString(decimal hours) |
|
FriendlyDateString |
Displays a date in friendly format. public static string FriendlyDateString(DateTime date, bool showTime, string timeSeparator) |
|
FriendlyElapsedTimeString |
Displays a number of milliseconds as friendly seconds, hours, minutes Pass -1 to get a blank date. public static string FriendlyElapsedTimeString(int milliSeconds) public static string FriendlyElapsedTimeString(double milliSeconds) public static string FriendlyElapsedTimeString(TimeSpan elapsed) |
|
IsBetween |
Returns whether a date time is between two other dates. Optionally can compare date only or date and time. public static bool IsBetween(DateTime date, DateTime startDate, DateTime endDate, bool includeTime) public static bool IsBetween(TimeSpan date, DateTime startDate, DateTime endDate) |
|
MimeDateTime |
Converts the passed date time value to Mime formatted time string public static string MimeDateTime(DateTime Time) |
|
RoundDateToMinuteInterval |
Rounds an hours value to a minute interval 0 means no rounding public static decimal RoundDateToMinuteInterval(decimal hours, int minuteInterval, RoundingDirection direction) public static DateTime RoundDateToMinuteInterval(DateTime time, int minuteInterval, RoundingDirection direction) |
|
ShortDateString |
Returns a short date time string public static string ShortDateString(DateTime date, bool showTime, string separator) public static string ShortDateString(DateTime? date, bool ShowTime) |
|
ShortTimeString |
Short date time format that shows hours and minutes. Culture adjusted but packs down US dates. public static string ShortTimeString(DateTime date) |
|
ToTimeZoneTime |
Returns TimeZone adjusted time for a given from a Utc or local time. Date is first converted to UTC then adjusted. public static DateTime ToTimeZoneTime(DateTime time, string timeZoneId) public static DateTime ToTimeZoneTime(DateTime time, TimeZoneInfo tzi) |
|
Truncate |
Truncates a DateTime value to the nearest partial value. public static DateTime Truncate(DateTime date, DateTimeResolution resolution) |
Requirements
Namespace: Westwind.UtilitiesAssembly: westwind.utilities.dll
© West Wind Technologies, 1996-2024 • Updated: 06/29/24
Comment or report problem with topic