Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Formatting Numbers and Dates
Numbers and dates are displayed differently in different locales. This is generally straightforward using NSDateFormatter and NSNumberFormatter, which you are likely already familiar with.
For an introduction to NSDateFormatter and NSNumberFormatter, see the “Data Formatting Guide” in Apple’s documentation at developer.apple.com.
There are a few things to keep in mind, however. First, formatters are needed for input as well as output. Most developers remember to use a formatter for date input, but may forget to use one for numeric input. The decimal point is not universally used to separate whole from fractional digits on input. Some countries use a comma or an apostrophe. It’s best to validate number input using an NSDateFormatter rather than custom logic.