Skip to content

Commit

Permalink
v0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-sitong committed Feb 19, 2024
1 parent 8dd874f commit 4479297
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,24 @@ import (
"github.com/wang-sitong/d"
)
func main() {
data := date()
p.R(data)
p.R(1)
p.D(2)
p.R(3)
// "2024-02-19 14:25:22" now
date := d.Date()
// "2024-02-20 15:38:49" tomorrow
date = d.Date("Y-m-d H:i:s", 1)
// "2024-02-18 15:39:24" yesterday
date = d.Date("Y-m-d H:i:s", -1)
// "2024" year
date = d.Date("Y")
// "02" month
date = d.Date("m")
// "19" day
date = d.Date("d")
// "15" hour
date = d.Date("H")
// "42" minute
date = d.Date("i")
// "25" second
date = d.Date("s")
}
```

24 changes: 19 additions & 5 deletions README_ZH.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# wang-sitong/d

[En document](./README.md)

### 以人类可用的方式获取日期

```
Expand All @@ -12,11 +14,23 @@ import (
"github.com/wang-sitong/d"
)
func main() {
//
// "2024-02-19 14:25:22" 当前时间
date := d.Date()
panic(date)
// "2024-02-20 15:38:49" 明天
date = d.Date("Y-m-d H:i:s", 1)
// "2024-02-18 15:39:24" 昨天
date = d.Date("Y-m-d H:i:s", -1)
// "2024" 年
date = d.Date("Y")
// "02" 月
date = d.Date("m")
// "19" 日
date = d.Date("d")
// "15" 时
date = d.Date("H")
// "42" 分
date = d.Date("i")
// "25" 秒
date = d.Date("s")
}
```

![img_2.png](img_2.png)

0 comments on commit 4479297

Please # to comment.