An open API service indexing awesome lists of open source software.

https://github.com/coderzhuxh/xhdate

时间格式字符串格式化输出为任意格式
https://github.com/coderzhuxh/xhdate

Last synced: about 1 year ago
JSON representation

时间格式字符串格式化输出为任意格式

Awesome Lists containing this project

README

          

### 时间字符串转换为任意格式显示
_____________________________

[![AppVeyor](https://img.shields.io/appveyor/ci/gruntjs/grunt.svg?maxAge=2592000)](https://github.com/CoderZhuXH/XHDate)
[![Version Status](https://img.shields.io/cocoapods/v/XHDate.svg?style=flat)](http://cocoadocs.org/docsets/XHDate)
[![Support](https://img.shields.io/badge/support-iOS%207%2B-brightgreen.svg)](https://github.com/CoderZhuXH/XHDate)
[![Pod Platform](https://img.shields.io/cocoapods/p/XHDate.svg?style=flat)](http://cocoadocs.org/docsets/XHDate/)
[![Pod License](https://img.shields.io/cocoapods/l/XHDate.svg?style=flat)](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).

## 效果

![demo](https://github.com/CoderZhuXH/XHDateExample/blob/master/Demo.png)

## 使用方法

导入 #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 文件