Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


FormatTime

Formats a given TimeSpan object as a string in the format "X ms", "X s", or "X min", depending on the length of the time span.
Read time 1 minuteLast updated 10 days ago

Definition

FormatTime(TimeSpan)

Formats a given TimeSpan object as a string in the format "X ms", "X s", or "X min", depending on the length of the time span.
public static string FormatTime(TimeSpan timeSpan)

Parameters

timeSpan

The TimeSpan object to format.

Returns

Type

Description

stringA string representation of the input TimeSpan object.

FormatTime(float)

Formats a given time value as a string in the format "X ms", "X s", or "X min"
public static string FormatTime(float timeMs)

Parameters

timeMs

The time value to format, in milliseconds.

Returns

Type

Description

stringA string representation of the input float value.