首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏杨飞@益术

    iPhone开发小技巧

      NSDate *now=[NSDate new];  notification.fireDate=[now addTimeInterval:10];  notification.timeZone=[NSTimeZone object_getClassName(v)] isEqualToString:@"UIKeyboard"]) { v.backgroundColor = [UIColor redColor]; } } } 13、设置时区 NSTimeZone  *defaultTimeZone = [NSTimeZone defaultTimeZone]; NSTimeZone *tzGMT = [NSTimeZone timeZoneWithName:@" GMT"]; [NSTimeZone setDefaultTimeZone:tzGMT]; 上面两个时区任意用一个。

    1.2K30发布于 2019-02-21
  • 来自专栏浮躁的喧嚣

    iOS中的NSDate

    dateByAddingTimeInterval:5]; NSLog(@"%@",date1);//Thu Sep 13 16:16:23 2017 获取当前所处的时区 //获取系统的 NSTimeZone *systemZone = [NSTimeZone systemTimeZone]; //获取本地的 NSTimeZone *localZone = [NSTimeZone localTimeZone

    41410编辑于 2023-11-22
  • 来自专栏猿人谷

    时间与日期处理

    NSTimeZone NSTimeZone表示时区信息。 NSTimeZone *zone = [[NSTimeZone alloc] initWithName:@"America/Chicago"]; //NSTimeZone *zone = [NSTimeZone NSTimeZone *zone = [NSTimeZone systemTimeZone]; NSLog(@"%@",zone); 假如时区是上海,打印出的时区信息将会是:Asia/Shanghai [NSTimeZone setDefaultTimeZone:[[NSTimeZone alloc] initWithName:@"America/Chicago"]]; NSTimeZone *systemZone = [NSTimeZone systemTimeZone]; NSTimeZone *localZone = [NSTimeZone localTimeZone]; NSLog(@"%@",systemZone

    3.8K70发布于 2018-01-17
  • 来自专栏好派笔记

    iOS 时间类常用方法

    //当前日前日期     NSDate *today = [NSDate date];     //时区     NSTimeZone *zone = [NSTimeZone systemTimeZone

    77520发布于 2021-10-29
  • 来自专栏华仔的技术笔记

    NSDate相差8个小时问题

    NSDateFormatter alloc] init]; [outputFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]]; NSTimeZone * timezone = [NSTimeZone timeZoneForSecondsFromGMT:8 * 3600];//直接指定时区 [outputFormatter setTimeZone: outputFormatter stringFromDate:date]; NSLog(@"outputDate:%@", outputDate); //这里处理8个小时时间差问题,下面这三句可以解决相差8个小时问题 NSTimeZone * zone = [NSTimeZone systemTimeZone]; NSInteger interval = [zone secondsFromGMTForDate:date]; NSDate

    99590发布于 2018-05-17
  • 来自专栏iOS逆向与安全

    iOS小技能:自定义时间格式(适配iOS15.4之后12/24小时制的问题)

    alloc]initWithCalendarIdentifier:NSCalendarIdentifierISO8601]; formatter.timeZone = [NSTimeZone :@"Asia/Shanghai"];//东八区时间 //这样不管我们的手机是在哪里,打印出来的时间都是东八区的时间 // formatter.timeZone = [NSTimeZone timeZoneWithName:@"Asia/Tokyo"];//东九区时间 // formatter.timeZone = [NSTimeZone timeZoneWithName: @"GMT"];//零区时间 // formatter.timeZone = [NSTimeZone timeZoneWithName:@"UTC"];//零区时间,和GMT一样 // ]initWithCalendarIdentifier:NSCalendarIdentifierISO8601]; formatter.timeZone = [NSTimeZone

    2K20编辑于 2022-08-22
  • 来自专栏Rindew的iOS技术分享

    iOS NSDate计算之夏令时

    代码验证下 NSTimeInterval daylightSavingInterval = [[NSTimeZone systemTimeZone] daylightSavingTimeOffsetForDate 其他方法可参考NSTimeZone类的方法。 isDaylightSavingTimeForDate或者daylightSavingTimeOffsetForDate判断 NSTimeInterval daylightSavingInterval = [[NSTimeZone

    1.6K20编辑于 2022-03-24
  • 来自专栏码客

    开发中使用throttle和debounce

    NSDateFormatter *df = [NSDateFormatter new]; [df setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; df.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:[NSTimeZone localTimeZone].secondsFromGMT]; NSString *localDateString

    1.9K51发布于 2019-10-22
  • 来自专栏Guangdong Qi

    iOS 每天某些时间点做某些事情

    greCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; NSTimeZone *timeZone = [[NSTimeZone alloc] initWithName:@"Asia/Shanghai"]; [greCalendar setTimeZone: timeZone

    1K60发布于 2018-05-24
  • 来自专栏岑志军的专栏

    iOS 两日期之间相差几天

    date); NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setTimeZone:[NSTimeZone

    1.8K50发布于 2018-05-28
  • 来自专栏ShaoYL

    iOS 时间和时间戳之间转化

    // 格式化时间 NSDateFormatter* formatter = [[NSDateFormatter alloc] init]; formatter.timeZone = [NSTimeZone

    1.7K130发布于 2018-05-11
  • 来自专栏Alice

    UIPickView的简单使用

    ; NSLog(@"date-----%@",date); NSLog(@"timeStr-------%@",timeStr); // NSTimeZone *timeZone=[NSTimeZone systemTimeZone]; // NSInteger seconds=[timeZone secondsFromGMTForDate:date]

    1.4K50发布于 2018-02-01
  • 来自专栏代码小技巧分享分析

    iOS 设置每天下午4点推送本地通知

    notification.repeatInterval=kCFCalendarUnitWeekday;//循环通知的周期 notification.timeZone=[NSTimeZone

    1.2K20发布于 2021-10-29
  • 来自专栏非典型技术宅

    iOS动画系列之二:带时分秒指针的时钟动画(下)1. 创建CALayer2. 设置时分秒针3. 创建CADisplayLink4. 成稿

    //获取本地时区 NSTimeZone *tZone = [NSTimeZone localTimeZone]; // 获取日历 NSCalendar *calendar = [

    1.2K10发布于 2018-06-28
  • 来自专栏一“技”之长

    iOS开发UI之日期控件的使用(UIDatePicker)

    locale; 设置本地化环境 @property (nonatomic, copy)   NSCalendar *calendar; 设置日历 @property (nonatomic, retain) NSTimeZone

    1.3K20发布于 2018-08-15
  • 来自专栏DannyHoo的专栏

    iOS开发中时间戳和时间的相互转换

    //他们与我们有7个小时的时差,所以他们那还没到这个时间呢...那就是把未来的事做了 NSTimeZone* timeZone = [NSTimeZonetimeZoneWithName:@"Asia

    3.2K10发布于 2018-09-13
  • 来自专栏技术拓展

    腾讯云V3签名方法之iOS

    (NSTimeInterval)time]; //转为字符串 NSDateFormatter *format = [[NSDateFormatter alloc]init]; NSTimeZone * timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0]; [format setTimeZone:timeZone]; [format

    3.9K110发布于 2020-08-03
  • 来自专栏王大锤

    iOS 本地通知

    // 设置通知的提醒时间 NSDate *currentDate = [NSDate date]; notification.timeZone = [NSTimeZone

    1.5K50发布于 2018-05-17
  • 来自专栏進无尽的文章

    多媒体 -获取本地图片和视频文件

    NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setTimeZone:[NSTimeZone

    1.1K20发布于 2018-09-12
  • 来自专栏滕先生的博客

    iOS 本地推送概念步骤:属性:点击通知跳到指定控制器界面快捷回复功能(iOS 8以后可用), category 属性的使用方法

    提醒Alter效果 6、设置时区,一般设置为 [NSTimeZone defaultTimeZone],跟随手机的时区 @property(nullable, nonatomic,copy) NSTimeZone

    3.3K60发布于 2018-05-18
领券