Class TimeSpanUtility
Namespace: UnityEngine.Localization.SmartFormat.Utilities
Syntax
public static class TimeSpanUtility
Properties
AbsoluteDefaults
These are the absolute default options that will be used as a safeguard, just in case DefaultFormatOptions is missing a value.
Declaration
public static TimeSpanFormatOptions AbsoluteDefaults { get; }
Property Value
Type | Description |
---|---|
TimeSpanFormatOptions |
DefaultFormatOptions
These are the default options that will be used when no option is specified.
Declaration
public static TimeSpanFormatOptions DefaultFormatOptions { get; set; }
Property Value
Type | Description |
---|---|
TimeSpanFormatOptions |
Methods
Round(TimeSpan, Int64)
Returns the TimeSpan
closest to the specified interval.
For example: Round("00:57:00", TimeSpan.TicksPerMinute * 5) => "00:55:00"
Declaration
public static TimeSpan Round(this TimeSpan FromTime, long intervalTicks)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | FromTime | A |
Int64 | intervalTicks | Specifies the interval for rounding. Use |
Returns
Type | Description |
---|---|
TimeSpan |
ToTimeString(TimeSpan, TimeSpanFormatOptions, TimeTextInfo)
Turns a TimeSpan into a human-readable text.
Uses the specified timeSpanFormatOptions.
For example: "31.23:59:00.555" = "31 days 23 hours 59 minutes 0 seconds 555 milliseconds"
Declaration
public static string ToTimeString(this TimeSpan FromTime, TimeSpanFormatOptions options, TimeTextInfo timeTextInfo)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | FromTime | |
TimeSpanFormatOptions | options | A combination of flags that determine the formatting options. These will be combined with the default timeSpanFormatOptions. |
TimeTextInfo | timeTextInfo | An object that supplies the text to use for output |
Returns
Type | Description |
---|---|
String |