# Formatting Overview

A frequent requirement is the ability to format numbers and dates as text, or to take text data and turn it into numbers or dates.

Starting with build 7.0.7252, Inaportwas revised to substantially upgrade its formatting capabilities, and leverage the functionality provided by the .Net framework to allow culture specific formats.

The new standard functions are:

- n2s(number, format [,culture]) - convert a number to a string in the format specified
- s2n(string [,culture]) - convert a string to a floating point number
- s2int(string [, culture]) - convert a string to an integer
- d2s(date, format [, culture]) - convert a date to a string in the format specified
- s2d(string, [, format] [, culture]) - convert a string to a date

The optional parameters for these functions are:

format - a string indicating the format to be used for the conversion, for example "$#,##0.00" or "dd MMM yyyy". The format string may use a Standard Specifier or a Custom Format.

culture - an indication of the culture to be used when interpreting the format; for example "en-US" or "fr-FR". The culture specifier provides information such as: is the decimal point a "." or a ",". The default culture is the Invariant Culture, which is associated with the English language but not with any country or region.

## Formats

The formats are used to control how a string is generated or interpreted.

The Standard Codes provide a short hand way to specify a format. For example:

- "C" - currency - will produce a currency string in the format of the culture specified.
- "g" - Short Date time - a date in with the date and the time as specified in the Date and time formats in the Regional Settings for the machine

A Custom Code allows you to precisely control the format by using a set of standard symbols. For example:

- "#,##0.0#;(#,##0.0#)" - format a number with thousands separator, at least one digit after the decimal point, and surround with brackets if it is negative
- "dd MMM yyyy" - format a date with 2 digit day of month, month name in short form, and 4 digit year.

For more information, see: Standard Numeric Format, Custom Numeric Format, Standard Date Format, Custom Date Format.

## Culture

Different cultures will format the same numeric or date value in different ways. For example, in the United States the 14th of April 2008 will be represented as "04/14/2008", but in the United Kingdom it will be "14/04/2008".

In addition, standard characters may change; for example in UK or US the decimal point is "."; in most European countries, it is ",".

Using a culture specifier allows you to control how a string is generated or interpreted. The culture specifier provides information about the language (en for English, fr for French) and the region (US for United States, Ca for Canada. So

- en-US - US English
- fr-CA - Canadian French

For more information, see Culture Specifiers.