Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix strftime docs and add another example #5204

Merged
merged 2 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/language/functions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Zed's [primitive types](../../formats/zed.md#1-primitive-types), e.g.,
* [shape](shape.md) - apply cast, fill, and order
* [split](split.md) - slice a string into an array of strings
* [sqrt](sqrt.md) - square root of a number
* [strftime](strftime.md) - format time values
* [trim](trim.md) - strip leading and trailing whitespace
* [typename](typename.md) - look up and return a named type
* [typeof](typeof.md) - the type of a value
Expand Down
11 changes: 10 additions & 1 deletion docs/language/functions/strftime.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ strftime(format: string, t: time) -> string
```

### Description
The _strftime_ function returns a string represenation of time `t`
The _strftime_ function returns a string representation of time `t`
as specified by the provided string `format`. `format` is a string
containing format directives that dictate how the time string is
formatted.
Expand Down Expand Up @@ -65,3 +65,12 @@ echo 2024-07-30T20:05:15.118252Z | zq -z 'strftime("%Y", this)' -
```mdtest-output
"2024"
```

Print a date in European format with slashes
```mdtest-command
echo 2024-07-30T20:05:15.118252Z | zq -z 'strftime("%d/%m/%Y", this)' -
```
=>
```mdtest-output
"30/07/2024"
```