...
The format syntax follows .NET String Formatting. Refer to this article for a comprehensive documentation of the format.
Info | ||
---|---|---|
| ||
Check out the string formatting cheat sheet http://www.cheat-sheets.org/saved-copy/msnet-formatting-strings.pdf |
Examples
Numeric Formats
Applying some custom numeric format strings to specific data types and values. In this example we will change the text format of a temperature:
format string | value example | result |
---|---|---|
{0:p} or {0:P} | 1 | 100.00% |
{0:00.0} °C | 22.3 | 22.3 °C |
DateTime Formats
DateTime formats typically depend on system localization settings.
format string | value example | result |
---|---|---|
{0:d} | 2020-12-10 | 12/10/2020 (short date) |
{0:dddd} | 2018-09-19 | Wednesday |
{0:yyyy} | 2018-09-19 | 2018 |