https://github.com/coderzhuxh/xhdate
时间格式字符串格式化输出为任意格式
https://github.com/coderzhuxh/xhdate
Last synced: about 1 year ago
JSON representation
时间格式字符串格式化输出为任意格式
- Host: GitHub
- URL: https://github.com/coderzhuxh/xhdate
- Owner: CoderZhuXH
- License: mit
- Created: 2017-04-16T07:46:36.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-23T02:27:50.000Z (over 8 years ago)
- Last Synced: 2025-04-11T15:10:17.584Z (about 1 year ago)
- Language: Objective-C
- Size: 177 KB
- Stars: 23
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### 时间字符串转换为任意格式显示
_____________________________
[](https://github.com/CoderZhuXH/XHDate)
[](http://cocoadocs.org/docsets/XHDate)
[](https://github.com/CoderZhuXH/XHDate)
[](http://cocoadocs.org/docsets/XHDate/)
[](https://github.com/CoderZhuXH/XHDate/blob/master/LICENSE)
### 特性:
* 1.支持时间格式字符串转换为任意格式时间
* 2.例如:2017-04-16 13:08:06 支持转换为以下格式
星期几
2017年04月16日
2017年04月
04月16日
2017年
13时08分01秒
13时08分
08分01秒
2017-04-16
2017-04
04-16
2017
13:08:06
13:08
08:06
### 技术交流群(群号:537476189).
## 效果

## 使用方法
导入 #import "NSString+XHDateFormat.h" 直接掉用下面方法转换为需要格式
```objc
self.timeString = @"2017-04-16 13:08:06";
//星期
NSString *time0 = self.timeString.xh_formatWeekDay;
//2017年04月16日
NSString *time1 = self.timeString.xh_formatNianYueRi;
//2017年04月
NSString *time2 = self.timeString.xh_formatNianYue;
//04月16日
NSString *time3 = self.timeString.xh_formatYueRi;
//2017年
NSString *time4 = self.timeString.xh_formatNian;
//13时08分01秒
NSString *time5 = self.timeString.xh_formatShiFenMiao;
//13时08分
NSString *time6 = self.timeString.xh_formatShiFen;
//08分01秒
NSString *time7 = self.timeString.xh_formatFenMiao;
//2017-04-16
NSString *time8 = self.timeString.xh_format_yyyy_MM_dd;
//2017-04
NSString *time9 = self.timeString.xh_format_yyyy_MM;
//04-16
NSString *time10 = self.timeString.xh_format_MM_dd;
//2017
NSString *time11 = self.timeString.xh_format_yyyy;
//13:08:06
NSString *time12 = self.timeString.xh_format_HH_mm_ss;
//13:08
NSString *time13 = self.timeString.xh_format_HH_mm;
//08:06
NSString *time14 = self.timeString.xh_format_mm_ss;
```
## 安装
### 1.手动添加:
* 1.将 XHDate 文件夹添加到工程目录中
* 2.导入 XHDate.h
## 系统要求
* 该项目最低支持 iOS 7.0 和 Xcode 7.0
## 许可证
XHDate 使用 MIT 许可证,详情见 LICENSE 文件