NSDateFormatterStyle.MediumStyle Doesn't Show In IPhone
I'm using NSDateFormatterStyle.MediumStyle in my application to convert the date. I display the date on label with font size of 12
It functions on the
iPad
simulator it show like "nov 12,1994" but on my
iPhone
device it shows short formatter: "11/12/1994".
Do you know why it function on the iPad but not in the iPhone
Answer
From the NSDateFormatterStyle
documentation :
The format for these date and time styles is not exact because they depend on the locale, user preference settings, and the operating system version. Do not use these constants if you want an exact format.
That said, I assume your iPad and your iPhone are set to different locales
If you want your dates to be as per the iPad example above across all locales, you can create your own formatter
let date = NSDate()
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "MMM d, yyyy"
dateFormatter.stringFromDate(date)
Related Questions
- → Function Undefined in Axios promise
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Click to navigate on mobile devices
- → Playing Video - Server is not correctly configured - 12939
- → How to allow api access to android or ios app only(laravel)?
- → Axios array map callback
- → Access the Camera and CameraRoll on Android using React Native?
- → Update React [Native] View on Day Change
- → Shopify iOS SDK - issue converting BuyProductVariant to BuyProduct
- → BigCommerce and shopify API
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → React Native - Differences between Android and IOS
- → What is the difference between React Native and React?