[This is preliminary documentation and is subject to change.]
The DateTimeUtil type exposes the following methods.
Methods
| Member | Description | |
|---|---|---|
| ParseMiniTimespan(String) | Parses the given string as a TimeSpan in compact representation. Throws exceptions on failure. | |
| ToCompactString(DateTime) | ||
| ToCompactString(TimeSpan) | ||
| ToMiniString(TimeSpan) | Converts given TimeSpan to compact string representation. | |
| ToSecondsString(TimeSpan) | Converts a TimeSpan to a string containing the number of seconds.
If the timestamp is zero seconds, returns an empty string. | |
| ToSecondsString(TimeSpan, StringBuilder) | Serializes the given TimeSpan to the given StringBuilder, as the number of seconds. | |
| ToUnixTime(DateTime) | Converts a DateTime to UTC Unix Timestamp. | |
| ToUnixTimeString(DateTime) | Converts a DateTime to a string containing the UTC Unix Timestamp.
If the date equals DateTime.MinValue, returns an empty string. | |
| ToUnixTimeString(DateTime, StringBuilder) | Appends a UTC Unix Timestamp to the given StringBuilder.
If the date equals DateTime.MinValue, nothing is appended. | |
| TryParseDateTime(Int64) | Creates a DateTime from a Utc Unix Timestamp. | |
| TryParseDateTime(String, DateTime%) | Tries to create a DateTime from a string containing a Utc Unix Timestamp.
If the string was empty, returns false and does not affect result. | |
| TryParseMiniTimespan(String, TimeSpan%) | Attempts to parse the given string as a TimeSpan in compact representation.
No exception is thrown if parsing failed. | |
| TryParseTimeSpan(String, TimeSpan%) | Tries to create a TimeSpan from a string containing the number of seconds.
If the string was empty, returns false and sets result to TimeSpan.Zero |