Skip to content

Commit

Permalink
Update content
Browse files Browse the repository at this point in the history
  • Loading branch information
gouguoyin committed Jan 26, 2024
1 parent 7ff566c commit 239afeb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
9 changes: 9 additions & 0 deletions README.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ carbon.SetDefault(carbon.Default{

> 如果没有设置,默认布局模板是 `2006-01-02 15:04:05`, 默认时区是 `Local`, 默认一周开始日期是 `Sunday(周日)`, 默认语言是 `en`
##### Carbon 和 time.Time 互转

```go
// 将标准 time.Time 转换成 Carbon
carbon.CreateFromStdTime(time.Now())
// 将 Carbon 转换成标准 time.Time
carbon.Now().ToStdTime()
```

##### 昨天、今天、明天

```go
Expand Down
20 changes: 10 additions & 10 deletions README.jp.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import "gitee.com/golang-module/carbon"

```go
carbon.SetDefault(carbon.Default{
Layout: carbon.RFC3339Layout,
Layout: carbon.DateTimeLayout,
Timezone: carbon.PRC,
WeekStartsAt: carbon.Sunday,
Locale: "jp",
Expand All @@ -69,6 +69,15 @@ carbon.SetDefault(carbon.Default{

> 設定されていない場合,デフォルトのレイアウト テンプレートは `2006-01-02 15:04:05`,デフォルトのタイムゾーンは `Local`,デフォルトの週の開始日は `日曜日`,デフォルトの言語は `en` です。
##### Carbon と time.Time 交換

```go
// 標準の time.Time を Carbon に変換します
carbon.CreateFromStdTime(time.Now())
// Carbon を標準の time.Time に変換します
carbon.Now().ToStdTime()
```

##### 昨日、今日、明日

```go
Expand Down Expand Up @@ -245,15 +254,6 @@ carbon.ParseByLayout("今天是 2020年08月05日13时14分15秒", "今天是 20
carbon.ParseByLayout("2020-08-05 13:14:15", "2006-01-02 15:04:05", carbon.Tokyo).ToDateTimeString() // 2020-08-05 14:14:15
```

##### Carbon と time.Time 交換

```go
// 標準の time.Time を Carbon に変換します
carbon.CreateFromStdTime(time.Now())
// Carbon を標準の time.Time に変換します
carbon.Now().ToStdTime()
```

##### 始まりと終わり

```go
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ carbon.SetDefault(carbon.Default{

> If not set, the default layout is `2006-01-02 15:04:05`, the default timezone is `Local`, the default week start date is `Sunday` and the default language locale is `en`
##### Convert between Carbon and Time

```go
// Convert standard Time.time into Carbon
carbon.CreateFromStdTime(time.Now())
// Convert Carbon into standard Time.time
carbon.Now().ToStdTime()
```

##### Yesterday, today and tomorrow

```go
Expand Down Expand Up @@ -243,15 +252,6 @@ carbon.ParseByLayout("It is 2020-08-05 13:14:15", "It is 2006-01-02 15:04:05").T
carbon.ParseByLayout("今天是 2020年08月05日13时14分15秒", "今天是 2006年01月02日15时04分05秒").ToDateTimeString() // 2020-08-05 13:14:15
```

##### Convert between Carbon and Time

```go
// Convert standard Time.time into Carbon
carbon.CreateFromStdTime(time.Now())
// Convert Carbon into standard Time.time
carbon.Now().ToStdTime()
```

##### Boundary

```go
Expand Down

0 comments on commit 239afeb

Please sign in to comment.