Date

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.

Tips

Intro

date now reads the current time.

date now

format date can print just the year.

date now | format date "%Y"

Basic

The year text can become an integer.

date now | format date "%Y" | into int

The month text can become an integer.

date now | format date "%m" | into int

Intermediate

Year, integer, then text again.

date now | format date "%Y" | into int | into string

Split a year-month string into parts.

date now | format date "%Y-%m" | split row "-" | length

Advanced

Four steps from the year to a count.

date now | format date "%Y" | into string | str length | math abs