2022-02-14 03:22:51 +01:00
|
|
|
---
|
|
|
|
title: date format
|
|
|
|
layout: command
|
2022-03-04 13:10:09 +01:00
|
|
|
version: 0.59.1
|
2022-02-14 03:22:51 +01:00
|
|
|
---
|
|
|
|
|
2022-02-20 02:13:33 +01:00
|
|
|
Format a given date using a format string.
|
2022-02-14 03:22:51 +01:00
|
|
|
|
|
|
|
## Signature
|
|
|
|
|
2022-02-20 02:13:33 +01:00
|
|
|
```> date format (format string) --list```
|
2022-02-14 03:22:51 +01:00
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
- `format string`: the desired date format
|
2022-02-20 02:13:33 +01:00
|
|
|
- `--list`: lists strftime cheatsheet
|
2022-02-14 03:22:51 +01:00
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
2022-02-20 02:13:33 +01:00
|
|
|
Format a given date using the default format (RFC 2822).
|
|
|
|
```shell
|
|
|
|
> "2021-10-22 20:00:12 +01:00" | date format
|
|
|
|
```
|
|
|
|
|
|
|
|
Format a given date using a given format string.
|
2022-02-14 03:22:51 +01:00
|
|
|
```shell
|
|
|
|
> date format '%Y-%m-%d'
|
|
|
|
```
|
|
|
|
|
2022-02-20 02:13:33 +01:00
|
|
|
Format a given date using a given format string.
|
2022-02-14 03:22:51 +01:00
|
|
|
```shell
|
|
|
|
> date format "%Y-%m-%d %H:%M:%S"
|
|
|
|
```
|
|
|
|
|
2022-02-20 02:13:33 +01:00
|
|
|
Format a given date using a given format string.
|
2022-02-14 03:22:51 +01:00
|
|
|
```shell
|
|
|
|
> "2021-10-22 20:00:12 +01:00" | date format "%Y-%m-%d"
|
|
|
|
```
|