Almost every variables (that are not already strings!) can have .ToString() applied to them to convert them to strings “the way you want them to”. Of course, any time you output a variable, example:[[=Contact.f_Birthday;]], this gets converted to text. We have some default conversions, but they’re not always appropriate (for instance, a decimal value will output a lot of zeroes, which does not look too good on an account statement). When you append .ToString(“…”) on a value, the parameter that you pass to the function is passed directly to the .ToString() method of the basic .NET datatype involved. So Order.InvoiceTotal.ToString(…) actually executes.NET’s decimal.ToString(…) method.
This means .ToString() supports all format strings that are available in .NET. You can visit the MSDN document site for the full reference, a good starting point is this:
- Custom Numeric Format Strings: http://msdn.microsoft.com/en-us/library/0c899ak8.aspx
- Custom Date and Time Format Strings: http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx