Cities Daylight saving time database
I am trying to get a database with cities and it's corresponding timezone including daylight saving time but I cannot find it.
I am making an iOS
and Android
application where a user can choose from which city he or she is and represents the time but for that I need the data to calculate the right time.
My current solution is to use the TimeZone.getAvailableIDs()
(ID's are same for Android
) but I discovered that there are a lot of cities missing such as Beijing and Abu Dhabi. Anyone any solution?
Here we can do one thing. Set a button in your app and add the below code in the button's action. So u can get the present date and time of their location.And the u can save the information by hitting your api(webservice of app). -----------------------------------code----------------------------------
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
[dateFormatter setTimeZone:gmt];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.000'Z'"];
NSString *iso8601String = [dateFormatter stringFromDate:self];
(Nj)
链接地址: http://www.djcxy.com/p/29368.html下一篇: 城市夏令时数据库