seq date for generators
Print sequences of dates.
Signature
> seq date {flags}
Flags
-
--output-format, -o {string}: Prints dates in this format (defaults to %Y-%m-%d). -
--input-format, -i {string}: Give argument dates in this format (defaults to %Y-%m-%d). -
--begin-date, -b {string}: Beginning date range. -
--end-date, -e {string}: Ending date. -
--increment, -n {oneof<duration, int>}: Increment dates by this duration (defaults to days if integer). -
--days, -d {int}: Number of days to print (ignored if periods is used). -
--periods, -p {int}: Number of periods to print. -
--reverse, -r: Print dates in reverse.
Input/output types:
| input | output |
|---|---|
| nothing | list<string> |
Examples
Return a list of the next 10 days in the YYYY-MM-DD format
> seq date --days 10
Return the previous 10 days in the YYYY-MM-DD format
> seq date --days 10 --reverse
Return the previous 10 days, starting today, in the MM/DD/YYYY format
> seq date --days 10 -o '%m/%d/%Y' --reverse
Return the first 10 days in January, 2020
> seq date --begin-date '2020-01-01' --end-date '2020-01-10' --increment 1day ╭───┬────────────╮ │ 0 │ 2020-01-01 │ │ 1 │ 2020-01-02 │ │ 2 │ 2020-01-03 │ │ 3 │ 2020-01-04 │ │ 4 │ 2020-01-05 │ │ 5 │ 2020-01-06 │ │ 6 │ 2020-01-07 │ │ 7 │ 2020-01-08 │ │ 8 │ 2020-01-09 │ │ 9 │ 2020-01-10 │ ╰───┴────────────╯
Return the first 10 days in January, 2020 using --days flag
> seq date --begin-date '2020-01-01' --days 10 --increment 1day ╭───┬────────────╮ │ 0 │ 2020-01-01 │ │ 1 │ 2020-01-02 │ │ 2 │ 2020-01-03 │ │ 3 │ 2020-01-04 │ │ 4 │ 2020-01-05 │ │ 5 │ 2020-01-06 │ │ 6 │ 2020-01-07 │ │ 7 │ 2020-01-08 │ │ 8 │ 2020-01-09 │ │ 9 │ 2020-01-10 │ ╰───┴────────────╯
Return the first five 5-minute periods starting January 1, 2020
> seq date --begin-date '2020-01-01' --periods 5 --increment 5min --output-format '%Y-%m-%d %H:%M:%S' ╭───┬─────────────────────╮ │ 0 │ 2020-01-01 00:00:00 │ │ 1 │ 2020-01-01 00:05:00 │ │ 2 │ 2020-01-01 00:10:00 │ │ 3 │ 2020-01-01 00:15:00 │ │ 4 │ 2020-01-01 00:20:00 │ ╰───┴─────────────────────╯
print every fifth day between January 1st 2020 and January 31st 2020
> seq date --begin-date '2020-01-01' --end-date '2020-01-31' --increment 5day ╭───┬────────────╮ │ 0 │ 2020-01-01 │ │ 1 │ 2020-01-06 │ │ 2 │ 2020-01-11 │ │ 3 │ 2020-01-16 │ │ 4 │ 2020-01-21 │ │ 5 │ 2020-01-26 │ │ 6 │ 2020-01-31 │ ╰───┴────────────╯
increment defaults to days if no duration is supplied
> seq date --begin-date '2020-01-01' --end-date '2020-01-31' --increment 5 ╭───┬────────────╮ │ 0 │ 2020-01-01 │ │ 1 │ 2020-01-06 │ │ 2 │ 2020-01-11 │ │ 3 │ 2020-01-16 │ │ 4 │ 2020-01-21 │ │ 5 │ 2020-01-26 │ │ 6 │ 2020-01-31 │ ╰───┴────────────╯
print every six hours starting January 1st, 2020 until January 3rd, 2020
> seq date --begin-date '2020-01-01' --end-date '2020-01-03' --increment 6hr --output-format '%Y-%m-%d %H:%M:%S' ╭───┬─────────────────────╮ │ 0 │ 2020-01-01 00:00:00 │ │ 1 │ 2020-01-01 06:00:00 │ │ 2 │ 2020-01-01 12:00:00 │ │ 3 │ 2020-01-01 18:00:00 │ │ 4 │ 2020-01-02 00:00:00 │ │ 5 │ 2020-01-02 06:00:00 │ │ 6 │ 2020-01-02 12:00:00 │ │ 7 │ 2020-01-02 18:00:00 │ │ 8 │ 2020-01-03 00:00:00 │ ╰───┴─────────────────────╯
Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/seq_date.html