zoukankan      html  css  js  c++  java
  • nsdate 前一天 后一天

    http://blog.sina.com.cn/s/blog_6568e7880100kfnh.html-(IBAction)prevDay:(id)sender{
        NSDateFormatter *format = [[NSDateFormatter alloc] init];
        [format setDateFormat:@"yyyy-MM-dd"];
        NSString * reportDate = [format stringFromDate:self.m_dataPicker.date];
        NSDate *date = [format dateFromString:reportDate];
        NSDate *newDate = [[NSDate alloc] initWithTimeIntervalSinceReferenceDate:([date timeIntervalSinceReferenceDate] - 24*3600)];
          reportDate = [format stringFromDate:newDate];
        [m_pickerButton setTitle:[[NSString alloc] initWithString:reportDate] forState:UIControlStateNormal];
        [m_dataPicker setDate:newDate animated:NO];
       
        [format release];
    }

    -(IBAction)nextDay:(id)sender{
        NSDateFormatter *format = [[NSDateFormatter alloc] init];
        [format setDateFormat:@"yyyy-MM-dd"];
        NSString *reportDate = [format stringFromDate:self.m_dataPicker.date];
        NSDate *date = [format dateFromString:reportDate];
        NSDate *newDate = [[NSDate alloc] initWithTimeIntervalSinceReferenceDate:([date timeIntervalSinceReferenceDate] + 24*3600)];
           reportDate = [format stringFromDate:newDate];
        
        [m_pickerButton setTitle:[[NSString alloc] initWithString:reportDate] forState:UIControlStateNormal];
        [m_dataPicker setDate:newDate animated:NO];
       
        
        [format release];
    }
  • 相关阅读:
    PHPStorm下XDebug配置
    HDU 4633 Who's Aunt Zhang (Polya定理+快速幂)
    VC++深入详解-第五章学习心得
    nginx access log logrotate配置
    判断变量是否存在(python)
    一步一步学android之布局管理器——LinearLayout
    向前辈致敬 strspn
    poj 1087 (最大流)
    cocos2d-x Touch 事件应用的一个例子
    [置顶] C#扩展方法 扩你所需
  • 原文地址:https://www.cnblogs.com/moonvan/p/2251642.html
Copyright © 2011-2022 走看看