Skip to content

Commit

Permalink
[stdlib/time] Update example
Browse files Browse the repository at this point in the history
Signed-off-by: Flipez <code@brauser.io>
  • Loading branch information
Flipez committed Oct 31, 2022
1 parent bee2c84 commit 0845a67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
12 changes: 5 additions & 7 deletions docs/docs/builtins/Time.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Take a look at [the source](https://github.com/Flipez/rocket-lang/blob/main/stdl


```js
🚀 » Time.format(Time.unix(), "%a %%b %b %e %H:%M:%S %Y")
» "Mon %Oct Oct 31 00:28:37 2022"
🚀 » Time.format(Time.unix(), "Mon Jan _2 15:04:05 2006")
» "Mon Oct 31 00:08:10 2022"
🚀 » Time.format(Time.unix(), "%a %b %e %H:%M:%S %Y")
» "Mon Oct 31 00:28:43 2022"
```
Expand All @@ -34,11 +34,9 @@ Take a look at [the source](https://github.com/Flipez/rocket-lang/blob/main/stdl


```js
🚀 » a = "2022-03-23"
» "2022-03-23"
🚀 » format = "2006-01-02"
» "2006-01-02"
🚀 » Time.parse(a, format)
🚀 » Time.parse("2022-03-23", "2006-01-02")
» 1647993600
🚀 » Time.parse("2022-03-23", "%Y-%m-%d")
» 1647993600
```

Expand Down
12 changes: 5 additions & 7 deletions stdlib/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ Take a look at [the source](https://github.com/Flipez/rocket-lang/blob/main/stdl
ReturnPattern: object.Args(
object.Arg(object.STRING_OBJ),
),
Example: `🚀 » Time.format(Time.unix(), "%a %%b %b %e %H:%M:%S %Y")
» "Mon %Oct Oct 31 00:28:37 2022"
Example: `🚀 » Time.format(Time.unix(), "Mon Jan _2 15:04:05 2006")
» "Mon Oct 31 00:08:10 2022"
🚀 » Time.format(Time.unix(), "%a %b %e %H:%M:%S %Y")
» "Mon Oct 31 00:28:43 2022"`,
},
Expand All @@ -93,11 +93,9 @@ Take a look at [the source](https://github.com/Flipez/rocket-lang/blob/main/stdl
ReturnPattern: object.Args(
object.Arg(object.STRING_OBJ),
),
Example: `🚀 » a = "2022-03-23"
» "2022-03-23"
🚀 » format = "2006-01-02"
» "2006-01-02"
🚀 » Time.parse(a, format)
Example: `🚀 » Time.parse("2022-03-23", "2006-01-02")
» 1647993600
🚀 » Time.parse("2022-03-23", "%Y-%m-%d")
» 1647993600`,
},
func(_ object.Environment, args ...object.Object) object.Object {
Expand Down

0 comments on commit 0845a67

Please sign in to comment.