Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Formatting

Methods for consistently formatting values
Read time 1 minuteLast updated 11 days ago

Definition

public static class Formatting

Static Methods

Method

Description

FormatDateTimeFormats a given DateTime object as a string in the format "yyyy/MM/dd HH:mm".
FormatDurationFormats a given TimeSpan object as a string in the format "HH:mm:ss".
FormatDurationWithMsFormats a given TimeSpan object as a string in the format "HH:mm:ss".
FormatFloatFormats a given float as a string.
FormatFramerateFormats a given float framerate as a string in the format "X fps".
FormatHzFormats a given frequency as a string in the format "X Hz" or "X kHz".
FormatLengthInSecondsFormats a given float duration as a string in the format "X.XXX s".
FormatPercentageFormats a decimal number as a percentage with a specified number of decimal places.
FormatSizeFormats a given size in bytes as a string in the format "X bytes".
FormatTimeFormats a given time value as a string in the format "X ms", "X s", or "X min"