Class TimerFormatterService
Service class for formatting time values into human-readable strings.
Inherited Members
Namespace: Serenity.Timer.Domain.Services
Assembly: Serenity.Timer.Domain.dll
Syntax
public class TimerFormatterService
Constructors
TimerFormatterService()
Declaration
public TimerFormatterService()
Methods
FormatTimeInSeconds(float)
Formats a time value in seconds into a human-readable string.
Declaration
public static string FormatTimeInSeconds(float seconds)
Parameters
| Type | Name | Description |
|---|---|---|
| float | seconds | The time value in seconds. |
Returns
| Type | Description |
|---|---|
| string | A formatted time string. |
GetFormattedHours(int)
Gets the formatted string representation of hours.
Declaration
public static string GetFormattedHours(int hours)
Parameters
| Type | Name | Description |
|---|---|---|
| int | hours | The number of hours. |
Returns
| Type | Description |
|---|---|
| string | A string representing the formatted hours. |
GetFormattedMilliseconds(float, string)
Gets the formatted string representation of milliseconds.
Declaration
public static string GetFormattedMilliseconds(float seconds, string decimalSeparator = ".")
Parameters
| Type | Name | Description |
|---|---|---|
| float | seconds | The number of seconds (including fractional part). |
| string | decimalSeparator | The decimal separator to use (default is "."). |
Returns
| Type | Description |
|---|---|
| string | A string representing the formatted milliseconds. |
GetFormattedMinutes(int)
Gets the formatted string representation of minutes.
Declaration
public static string GetFormattedMinutes(int minutes)
Parameters
| Type | Name | Description |
|---|---|---|
| int | minutes | The number of minutes. |
Returns
| Type | Description |
|---|---|
| string | A string representing the formatted minutes. |
GetFormattedSeconds(float)
Gets the formatted string representation of seconds.
Declaration
public static string GetFormattedSeconds(float seconds)
Parameters
| Type | Name | Description |
|---|---|---|
| float | seconds | The number of seconds. |
Returns
| Type | Description |
|---|---|
| string | A string representing the formatted seconds. |
GetFormattedTime(int, int, float)
Gets the formatted time string in "HH:MM:SS" format.
Declaration
public string GetFormattedTime(int hours, int minutes, float seconds)
Parameters
| Type | Name | Description |
|---|---|---|
| int | hours | The number of hours. |
| int | minutes | The number of minutes. |
| float | seconds | The number of seconds. |
Returns
| Type | Description |
|---|---|
| string | A string representing the formatted time. |