all
I'm new to ios programming. I want to set CST in the method
[dateFormatter setTimeZone:]
I have created a sample project to get all known timezones Code is here:
NSArray *timeZoneNames = [NSTimeZone knownTimeZoneNames];
for (NSTimeZone *timezon in timeZoneNames) {
NSLog(@"%@",timezon);
}
It gives the following result:
[Session started at 2011-09-28 09:50:28 +0530.] 2011-09-28 09:50:29.535 Timezonetest[10352:207] Africa/Abidjan
2011-09-28 09:50:29.537 Timezonetest[10352:207] Africa/Accra
2011-09-28 09:50:29.537 Timezonetest[10352:207] Africa/Addis_Ababa
2011-09-28 09:50:29.538 Timezonetest[10352:207] Africa/Algiers
........................
........................
........................
........................
2011-09-28 09:50:29.765 Timezonetest[10352:207] Pacific/Pago_Pago
2011-09-28 09:50:29.766 Timezonetest[10352:207] Pacific/Palau
2011-09-28 09:50:29.766 Timezonetest[10352:207] Pacific/Pitcairn
2011-09-28 09:50:29.767 Timezonetest[10352:207] Pacific/Pohnpei
2011-09-28 09:50:29.768 Timezonetest[10352:207] Pacific/Ponape
2011-09-28 09:50:29.769 Timezonetest[10352:207] Pacific/Port_Moresby
2011-09-28 09:50:29.773 Timezonetest[10352:207] Pacific/Rarotonga
2011-09-28 09:50:29.775 Timezonetest[10352:207] Pacific/Saipan
2011-09-28 09:50:29.775 Timezonetest[10352:207] Pacific/Tahiti
2011-09-28 09:50:29.776 Timezonetest[10352:207] Pacific/Tarawa
2011-09-28 09:50:29.776 Timezonetest[10352:207] Pacific/Tongatapu
2011-09-28 09:50:29.777 Timezonetest[10352:207] Pacific/Truk
2011-09-28 09:50:29.778 Timezonetest[10352:207] Pacific/Wake
2011-09-28 09:50:29.778 Timezonetest[10352:207] Pacific/Wallis
Anyone can say which is the name for CST(central Standard timezone) in the above list Thanks in Advance
try this by first method u got all time zone after that wat u want u set by key value.
NSLog(@"%@",[NSTimeZone abbreviationDictionary]);
[dateFormater setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"CST"]];