Added to_unix operator

This commit is contained in:
Mike Farah
2023-02-02 12:56:16 +11:00
parent f9f340b6bf
commit 915ab69922
5 changed files with 50 additions and 2 deletions
+13 -1
View File
@@ -87,7 +87,7 @@ updated: 2021-05-19T01:02:03Z
```
## From Unix
Converts from unix time
Converts from unix time. Note, you don't have to pipe through the tz operator :)
Running
```bash
@@ -98,6 +98,18 @@ will output
2023-02-02T01:38:49Z
```
## To Unix
Converts to unix time
Running
```bash
yq --null-input 'now | to_unix'
```
will output
```yaml
1621386123
```
## Timezone: from standard RFC3339 format
Returns a new datetime in the specified timezone. Specify standard IANA Time Zone format or 'utc', 'local'. When given a single parameter, this assumes the datetime is in RFC3339 format.