I am working on an application in which I save the current Date in the database but when my app runs in Arabic language the current date format is changed into Arabic. I mean the date format should be like this 09/02/2010 but the digits are converted to Arabic digits. So how do I convert them back to English digits even if my app running in the Arabic Language?
Share
In general it’s best to keep dates in an agnostic type and only format them when they must be displayed. A common format is storing the number of seconds since 1970, or another date you choose.
E.g. the following code will display the current time correctly formatted for the users local.
However when you do have a date in a locale-specific format, you can again use the formatter class to convert it. E.g.
For working with any type of locale-specific data (dates, currency, measurements) then the formatter classes are your friend.