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];
    }
  • 相关阅读:
    JAVA的HashTable源码分析
    散列表
    JAVA的HashSet源码分析
    Java中HashMap源码分析
    MySQL max_allowed_packet设置及问题
    通过分析 JDK 源代码研究 TreeMap 红黑树算法实
    红黑树详解
    TreeMap源码分析
    Vector的浅析
    web.xml 配置中classpath: 与classpath*:的区别
  • 原文地址:https://www.cnblogs.com/moonvan/p/2251642.html
Copyright © 2011-2022 走看看