Date Format.

D

One must be careful that, if his/her app uses system date then make sure it is having a predefined format also. Since Apple devices have individual default date formats and they are different for two different devices even if the device belongs to same category(i.e. iPhone 5, iPhone 4S, iPad and etc.)

Predefining the date format will fetch the date in the defined form independent of what the default date Format of the device is.

Have a look at the below code part:

NSDate *date = [NSDate date];

NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];

dateString = [dateFormat stringFromDate:date];

[dateFormat setDateFormat:@”dd-MMM-yyyy hh:mm a”];

It will help avoid the app crash due inconsistent default date formats.

 

About the author

shailesh.zambad
By shailesh.zambad

Category