清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | // // NSDate+Common.h // FreeDaily // // Created by YongbinZhang on 3/5/13. // Copyright (c) 2013 YongbinZhang // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import <Foundation/Foundation.h> @interface NSDate (Common) /**************************************************** *@Description:根据年份、月份、日期、小时数、分钟数、秒数返回NSDate *@Params: * year:年份 * month:月份 * day:日期 * hour:小时数 * minute:分钟数 * second:秒数 *@Return: ****************************************************/ + (NSDate *)dateWithYear:(NSUInteger)year Month:(NSUInteger)month Day:(NSUInteger)day Hour:(NSUInteger)hour Minute:(NSUInteger)minute Second:(NSUInteger)second; /**************************************************** *@Description:实现dateFormatter单例方法 *@Params:nil *Return:相应格式的NSDataFormatter对象 ****************************************************/ + (NSDateFormatter *)defaultDateFormatterWithFormatYYYYMMddHHmmss; + (NSDateFormatter *)defaultDateFormatterWithFormatYYYYMMdd; + (NSDateFormatter *)defaultDateFormatterWithFormatMMddHHmm; + (NSDateFormatter *)defaultDateFormatterWithFormatYYYYMMddHHmmInChinese; + (NSDateFormatter *)defaultDateFormatterWithFormatMMddHHmmInChinese; /********************************************************** *@Description:获取当天的包括“年”,“月”,“日”,“周”,“时”,“分”,“秒”的NSDateComponents *@Params:nil *@Return:当天的包括“年”,“月”,“日”,“周”,“时”,“分”,“秒”的NSDateComponents ***********************************************************/ - (NSDateComponents *)componentsOfDay; /**************************************************** *@Description:获得NSDate对应的年份 *@Params:nil *@Return:NSDate对应的年份 ****************************************************/ - (NSUInteger)year; /**************************************************** *@Description:获得NSDate对应的月份 *@Params:nil *@Return:NSDate对应的月份 ****************************************************/ - (NSUInteger)month; /**************************************************** *@Description:获得NSDate对应的日期 *@Params:nil *@Return:NSDate对应的日期 ****************************************************/ - (NSUInteger)day; /**************************************************** *@Description:获得NSDate对应的小时数 *@Params:nil *@Return:NSDate对应的小时数 ****************************************************/ - (NSUInteger)hour; /**************************************************** *@Description:获得NSDate对应的分钟数 *@Params:nil *@Return:NSDate对应的分钟数 ****************************************************/ - (NSUInteger)minute; /**************************************************** *@Description:获得NSDate对应的秒数 *@Params:nil *@Return:NSDate对应的秒数 ****************************************************/ - (NSUInteger)second; /**************************************************** *@Description:获得NSDate对应的星期 *@Params:nil *@Return:NSDate对应的星期 ****************************************************/ - (NSUInteger)weekday; /****************************************** *@Description:获取当天是当年的第几周 *@Params:nil *@Return:当天是当年的第几周 ******************************************/ - (NSUInteger)weekOfDayInYear; /**************************************************** *@Description:获得一般当天的工作开始时间 *@Params:nil *@Return:一般当天的工作开始时间 ****************************************************/ - (NSDate *)workBeginTime; /**************************************************** *@Description:获得一般当天的工作结束时间 *@Params:nil *@Return:一般当天的工作结束时间 ****************************************************/ - (NSDate *)workEndTime; /**************************************************** *@Description:获取一小时后的时间 *@Params:nil *@Return:一小时后的时间 ****************************************************/ - (NSDate *)oneHourLater; /**************************************************** *@Description:获得某一天的这个时刻 *@Params:nil *@Return:某一天的这个时刻 ****************************************************/ - (NSDate *)sameTimeOfDate; /****************************************** *@Description:判断与某一天是否为同一天 *@Params: * otherDate:某一天 *@Return:YES-同一天;NO-不同一天 ******************************************/ - ( BOOL )sameDayWithDate:(NSDate *)otherDate; /****************************************** *@Description:判断与某一天是否为同一周 *@Params: * otherDate:某一天 *@Return:YES-同一周;NO-不同一周 ******************************************/ - ( BOOL )sameWeekWithDate:(NSDate *)otherDate; /****************************************** *@Description:判断与某一天是否为同一月 *@Params: * otherDate:某一天 *@Return:YES-同一月;NO-不同一月 ******************************************/ - ( BOOL )sameMonthWithDate:(NSDate *)otherDate; /**************************************************** *@Description:获取时间的字符串格式 *@Params:nil *@Return:时间的字符串格式 ****************************************************/ - (NSString *)stringOfDateWithFormatYYYYMMddHHmmss; - (NSString *)stringOfDateWithFormatYYYYMMdd; - (NSString *)stringOfDateWithFormatMMddHHmm; - (NSString *)stringOfDateWithFormatYYYYMMddHHmmInChinese; - (NSString *)stringOfDateWithFormatMMddHHmmInChinese; @end |