Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jun 22, 2015
1 parent 73fbb36 commit a75d863
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# date
# date 时间操作

[![](https://img.shields.io/github/issues/jaywcjlove/date.js.svg)](https://github.com/jaywcjlove/date.js/issues) [![](https://img.shields.io/github/forks/jaywcjlove/date.js.svg)](https://github.com/jaywcjlove/date.js/network) [![](https://img.shields.io/github/stars/jaywcjlove/date.js.svg)](https://github.com/jaywcjlove/date.js/stargazers) [![](https://img.shields.io/github/release/jaywcjlove/date.js.svg)](https://github.com/jaywcjlove/date.js/releases)

## format

> 格式化时间
```js
Expand All @@ -16,6 +17,7 @@ var testStr = testDate.format("yyyy年MM月dd日hh小时mm分ss秒");


### ago

> 多少小时前、多少分钟前、多少秒前
```js
Expand All @@ -30,8 +32,21 @@ new Date('2010-02-02').ago('1987-04-03')
```

### toHHMMSS

> 时间转换,倒计时 '毫秒'.toHHMMSS(输出格式)
> 这个是基于 String 原型扩展出来的
```js
var dt = (new Date().getTime()).toString()
dt.toHHMMSS('hh时mm分ss秒') //=> 34时11分52秒
```

### TZC

> 解决因时区变更,导致显示服务器时间不准确

```js
"123112".toHHMMSS('hh时mm分ss秒') //=> 34时11分52秒
//服务端传入前端一般为秒,前端时间戳为毫秒所以要乘以1000
new Date(1434701732*1000).TZC(8)
```

0 comments on commit a75d863

Please sign in to comment.