想知道原理,可以了解初中地理。直接上代码。
-(NSString*)gettimewith:(double) lat with:(double )lng with:(BOOL)isSunRise withTime:(NSString*)dayTime{
if (lat<1&&isSunRise==YES) {
return [NSString stringWithFormat:@"%@ 07:00",dayTime];
}else if (lat<1&&isSunRise==NO) {
return [NSString stringWithFormat:@"%@ 17:00",dayTime];
}else{
NSDate *now1 = [NSDate date];
//实例化一个NSDateFormatter对象
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
//设定时间格式
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSDate *oldDate1 = [dateFormatter dateFromString: @"2020-01-01"];
NSCalendar *gregorian = [[NSCalendar alloc] init
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)